Multiple choice technology databases

DB2 WITH HOLD option What does WITH HOLD option do ?

  1. forces cursor to close after commit

  2. Keeps cursor open after commit

  3. Does not allow cursor to close till all rows are fetched

  4. Locks the cursor

  5. None of the above

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The WITH HOLD option in DB2 (and other RDBMS) keeps a cursor open across COMMIT operations. Without WITH HOLD, the cursor would close automatically when a COMMIT is issued. It doesn't force closure, lock the cursor, or wait for all rows to be fetched.

AI explanation

The WITH HOLD option on a DB2 cursor declaration keeps the cursor open and its position preserved across a COMMIT. Normally, a commit closes all open cursors and releases their locks/position; WITH HOLD overrides that default so an application can continue fetching rows after committing, which is useful for long-running batch processes that need periodic commits without losing their place.