Update and Delete Using WHERE CURRENT OF
In a stored procedure, update or delete a row at which the cursor is currently positioned.
Syntax
DELETE FROM table_name ... WHERE CURRENT OF cursor_name
UPDATE table_name SET ... WHERE CURRENT OF cursor_name
Description
This will update or delete the record that was last fetched by a cursor. The cursor must have been defined FOR UPDATE if this is an UPDATE statement. DELETE can be performed on a cursor that was not declared as FOR UPDATE, assuming that it was declared with an updatable query.
Parameters
table_name-
A table or view defined in the
FROMclause of the cursor definition query. Iftable_namereferences a view, the view must be updatable (see Using Updatable Views). cursor_name-
The name that was associated with the cursor using
DECLARE.