5. Embedded OpenSQL : Data Manipulation with Cursors : Using Cursors to Delete Data
 
Share this page                  
Using Cursors to Delete Data
The cursor version of the DELETE statement has the following syntax:
EXEC SQL DELETE FROM tablename
         WHERE CURRENT OF cursor_name;
The DELETE statement deletes the current row. The cursor must be positioned on a row (as the result of a FETCH statement) before a cursor delete can be performed. After the row is deleted, the cursor points to the position after the row (and before the next row) in the set. To advance the cursor to the next row, issue the FETCH statement.
You do not have to declare a cursor for update to perform a cursor delete.