How to commit an update each 10000 rows.



How to commit an update each 10000 rows.



SET SERVEROUTPUT ON SIZE 1000000
DECLARE
CURSOR c1 IS
SELECT ROWID RID from inter.revshar_daily_summary where txn_dt between 'XX-mar-2005' and 'XX-mar-2005'
v_count NUMBER:=0;
BEGIN
         FOR r1 in c1 LOOP
                  v_count:=v_count+1;
                  UPDATE inter.revshar_daily_summary set "....XXXXX...." WHERE rowid=r1.rid;
                  IF mod(v_count, 10000) = 0 THEN
                           commit;
                           dbms_output.put_line(v_count|| ' revshar_daily_summary records updated.');
                  END IF;
         END LOOP;
         dbms_output.put_line(v_count|| ' revshar_daily_summary records updated.');
         commit;
END;
/

commit;

Comments