bulk collect forall通过limit批量提交

来源:互联网 发布:淘宝菲慕最出名模特 编辑:程序博客网 时间:2024/05/27 00:31
declare
type forall_table is table of tb1%rowtype;
test_table forall_table;
cursor c1 is select *
  from infores_nb1.tb1 a
 where exists (select 1
          from infores_nb1.t2 b
         where a.subscode = b.worksheetcode)
   and a.intftype in ('resourceConfig', 'resourceRollback')
   and a.succeed = 1;
begin
open c1;
loop
fetch c1 bulk collect into test_table limit 1000;--1000行提交一次;
forall idx in test_table.first..test_table.last
insert into tb1_tmp values test_table(idx);
commit;
exit when c1%notfound;
end loop;
close c1;
exception
when others then
rollback;
end;


原创粉丝点击