Thursday, January 30, 2014

cursor delete with commit size



declare
  i number := 0;

 cursor s1
 is

 select seq_num from Tab where <>;


begin
  for c1 in s1 loop

       delete from TAb t1 where t1.seq_num = c1.seq_num;

           i := i + 1;              -- Commit after every X records

      if i > 10000 then
        commit;
        i := 0;
      end if;
  end loop;
      commit;
end;

SQL>

No comments:

Post a Comment