Can I get an example of a DB2 Stored Procedure with Loop & Commit?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • royarellano
    New Member
    • Feb 2011
    • 1

    Can I get an example of a DB2 Stored Procedure with Loop & Commit?

    I'm trying to create a DB2 stored procedure that will loop through a delete statement and commit after every 5000 records. Continuing to delete until the statement is satisfied and all records which fit the criteria are deleted from the table.

    Here is an example of my statement:
    Code:
    DELETE FROM (SELECT * FROM tablename WHERE date_stamp = CURRENT date);
    Thank you.
    Roy
Working...