Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2005

    Question Unanswered: Rollback Closes a cursor?

    Hi all,

    Cursors in DB2 follows the ANSI SQL standard of closing open cursors whenever a COMMIT or ROLLBACK statement is issued. But cursors that are declared with the WITH HOLD option remain open after a COMMIT statement is issued. Here all open cursors are closed when a ROLLBACK statement is issued.

    If we are processing something in a cursor and inside the cursor for every record we have to commit or rollback and then go to the next record.

    What will happen if i have to rollback on the 50th row and cursor has 500 rows to process?Here it closes the cursor itself since a rollback happened.

    What should i do to retain the cursor OPEN and the cursor position same as before the ROLLBACK happened. Some body help me on this..


  2. #2
    Join Date
    Aug 2001
    Have you checked the "SAVEPOINT ... ON ROLLBACK RETAIN CURSORS " ?
    Visit the new-look IDUG Website , register to gain access to the excellent content.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts