DELETE … WHERE CURRENT OF
Deletes the current row in a result set of a database cursor declared for update.
Syntax
DELETE FROM table-specification
WHERE CURRENT OF cid
- table-specification identifies the target table
- cid is the identifier of the database cursor declared for update.
Usage
Use DELETE ... WHERE CURRENT OF
to remove 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.
After the deletion, no current row exists; you cannot use the cursor to delete or update a row
until you reposition the cursor with a FETCH
statement.