UPDATE … WHERE CURRENT OF
Updates the current row in a result set of a database cursor declared for update.
Syntax
UPDATE table-specification
SET
column = { variable | sql-expression }
[,...]
WHERE CURRENT OF cid
- table-specification identifies the target table (see UPDATE for more details).
- column is a name of a table column.
- variable is a program variable, a record member or an array member used as a parameter buffer to provide values.
- sql-expression is an expression supported by
the database server, this can be a literal or
NULL
for example. - cid is the identifier of the database cursor declared for update.
Usage
Use UPDATE ... WHERE CURRENT OF
to modify the values of the row currently
pointed by the associated FOR
UPDATE
cursor.
The scope of reference of the cid cursor
identifier is local to the module where it is declared.
Therefore, you must execute the DECLARE
,UPDATE
or DELETE
instructions in the same module.
There must be a current row in the result set. Make sure that the SQL status returned by the
last FETCH
is equal to zero.
If the DECLARE
statement that created the cursor
specified one or more columns in the FOR UPDATE
clause,
you are restricted to updating only those columns in a subsequent UPDATE
... WHERE CURRENT OF
statement.