What is the purpose of the "FOR UPDATE OF" clause in a cursor? What will happen if we fire an UPDATE statement without using this clause in a COBOL-DB2 program?


The “FOR UPDATE OF” clause is given in the cursor declaration and it is used when we want to update the table. All the columns which need to be updated should be given in the cursor declaration.

The “FOR UPDATE OF” clause will place the exclusive lock on all the qualifying rows once the cursor is open. We can also update the table without using “FOR UPDATE CLAUSE” but in that case the exclusive lock will be placed on the row only when the UPDATE query will be executed.

Updated on: 15-Sep-2020

476 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements