performance - Insert within FORALL loop in PL/SQL -
is possible in pl/sql bulk insert using forall
?
type c_type1 record ( column1 table1.column1%type, column2 table1.column2%type, client table2.client%type ); type1 c_type1; cursor cur_t select * bulk collect recs table3 ; begin recs in cur_t loop select * type1 (select a.column1, a.column2,imm.client ... table1 a, table2 imm a.column1 = recs.column1 ) rownum=1; insert table2 values (recs.column1,type1.column2); ...
p.s : there more 80 columns inserted.
your question not pretty clear looking @ code have following. check if looking for.
declare cursor cur_t select t3.column1 , t1.column2 table3 t3 inner join table1 t1 on t3.column1 = t1.column1; type var_cur table of cur_t%rowtype; var var_cur; begin open cur_t; loop fetch cur_t bulk collect var limit 100; exit when cur_t%notfound; forall in 1 .. var.count save exceptions insert table2 values var(i); end loop; close distinctuseridcursor; commit; exception when others dbms_output.put_line('error in insertion of record' || '~~~~' || sqlerrm); indx in 1 .. sql%bulk_exceptions.count loop dbms_output.put_line (sql%bulk_exceptions (indx).error_index|| ': ' || sql%bulk_exceptions (indx).error_code); end loop; end;
Comments
Post a Comment