oracle pl / sql FORALL语句

时间:2014-07-27 19:49:25

标签: oracle plsql

我对这个程序感到困惑请逐行解释任何一个,并且必须在forall循环中如何变量可以迭代那里

DECLARE
 TYPE mysubs_type IS TABLE OF pls_integer INDEX BY pls_integer;
 TYPE mylist_type IS TABLE OF pls_integer INDEX BY pls_integer;
 mysubs mylist_type;
 mylist mylist_type;
BEGIN
 mylist(2) := 2;
     mysubs(10) := 2; -- point to mylist(2)
 mylist(3) := 3;
     mysubs(200) := 3; -- point to mylist(3)
 mylist(6) := 6;
     mysubs(30) := 6; -- point to mylist(6)
     mysubs(40) := 3; -- point to mylist(3)
 FORALL i IN VALUES OF mysubs
 INSERT INTO mynum_table(my_list) VALUES(mylist(i));
END;

1 个答案:

答案 0 :(得分:0)

I遍历bounds_clauseIN VALUES OF,表示imysubs的元素,并将在mysubs中迭代集合mysubs方式不连续。在这种情况下,在这种情况下4次。尊重2 6 3 3 的索引:

  • mysubs(10):2
  • mysubs(30):6
  • mysubs(40):3
  • mysubs(200):3

FORALL总是插入块:

{{1}}