DELETE (positioned)
Use the positioned DELETE statement to remove the current row of a view associated with an SQL cursor.
Syntax
DELETE WHERE CURRENT OF cursor-name
 
cursor-name ::= user-defined-name
Remarks
This statement is allowed in stored procedures, triggers, and at the session level.
*Note: Even though positioned DELETE is allowed at the session level, the DECLARE CURSOR statement is not. Use the SQLGetCursorName() API to obtain the cursor name of the active result set.
Examples
The following sequence of statements provide the setting for the positioned DELETE statement. The required statements for the positioned DELETE statement are DECLARE CURSOR, OPEN CURSOR, and FETCH FROM cursorname.
The Modern European History class has been dropped from the schedule, so this example deletes the row for Modern European History (HIS 305) from the Course table in the sample database:
CREATE PROCEDURE DropClass();
DECLARE :CourseName CHAR(7);
DECLARE c1 cursor
FOR SELECT name FROM course WHERE name = :CourseName;
BEGIN
SET :CourseName = 'HIS 305';
OPEN c1;
FETCH NEXT FROM c1 INTO :CourseName;
DELETE WHERE CURRENT OF c1;
END;
See Also
CREATE PROCEDURE
CREATE TRIGGER