Step 5a: Update the current row

When your program has positioned the cursor on a row, you can update its data by using the UPDATE statement with the WHERE CURRENT OF clause. The WHERE CURRENT OF clause specifies a cursor that points to the row you want to update.

The UPDATE ... WHERE CURRENT OF statement looks like this:

EXEC SQL
 UPDATE table-name
   SET column-1 = value [, column-2 = value] ...
   WHERE CURRENT OF cursor-name
END-EXEC.

When used with a cursor, the UPDATE statement:

After you update a row, the cursor's position remains on that row (that is, the current row of the cursor does not change) until you issue a FETCH statement for the next row.