FOR UPDATE OF Examples

The following sample query changes salaries, bonuses, and commissions in a hypothetical table named earnings. These changes are accomplished with positioned updates using a cursor named alter_up, and are limited to departments A1 and H12.

EXEC SQL DECLARE alter_up CURSOR FOR
  SELECT dept, empno, salary, bonus, comm
  FROM earnings
  WHERE dept IN ('A1','H12')
  FOR UPDATE OF salary, bonus, comm

The columns to be updated are indicated in the FOR UPDATE OF clause in the cursor declaration.