A(j)为数组 ?Oracle doesn't have 数组 concept

解决方案 »

  1.   

    insert into table_name(field2)
    commit;
    select field2 from tab where field3=A(j);
      

  2.   

    forall用于DML
    可以用
    for j in 1..n loop
     --stmt
    end loop;
      

  3.   

    sorry,看错你的意思了。你的用法是可以的。例:
    CREATE TABLE EMP ( 
      EMPNAME  VARCHAR2 (30)  NOT NULL, 
      DEPTID   NUMBER, 
    ) ; 
    declare 
      type num_type is varray(10) of number;
      nums num_type;
      i pls_integer;
    begin
      nums := num_type();
      nums.extend();
      nums(1) := 1;
      nums.extend();
      nums(2) := 2;
      nums.extend();
      nums(2) := 2;
      
      forall i in nums.first..nums.last
        insert into emp (empname, deptid) select empname, deptid from emp where deptid = nums(i);  
    end;
      

  4.   

    forall语句,我记得,循环体只能是dml语句。