Update/Delete from huge tables with intermediate commits

September 30, 2004

>>Script Language and Platform: SQL
If Database is in Archive log mode then look for archive generation.

Author: Susmit Sarkar

rem Usage: UPDATE/DELETE in a loop and commit very n records
rem =======================================

  r number := 0;
 cursor cursor_name
 is SELECT rowid, t.column_name FROM table_name t WHERE column_name = 'value';
 for x in cursor_name
      update table_name set column_name = 'value2'
             where rowid = x.rowid;
      r := r + 1;              -- Commit after every 1000 records
      if mod(i, 1000) then
      end if;
  end loop;

Disclaimer: We hope that the information on these script pages is valuable to you. Your use of the information contained in these pages, however, is at your sole risk. All information on these pages is provided "as -is", without any warranty, whether express or implied, of its accuracy, completeness, or fitness for a particular purpose... Disclaimer Continued

Back to Database Journal Home

The Network for Technology Professionals


About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers