In DB2, what is the purpose of using a cursor with a FOR UPDATE clause?

  • To automatically commit the transaction
  • To lock the rows fetched by the cursor for update operations
  • To optimize query performance
  • To retrieve data without locking any rows
Using a cursor with a FOR UPDATE clause in DB2 is intended to lock the rows fetched by the cursor. This ensures that the rows cannot be modified by other transactions until the current transaction completes. This feature is commonly used in scenarios where data consistency and integrity are crucial, such as in banking applications where multiple users may try to update the same data simultaneously. 
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *