|
|
DELETE CURRENT
Deletes the current row indicated by a cursor.
Usage
Embedded/ODBC/Procedural/JDBC.
Description
The row currently indicated by the cursor is deleted from the base table implied by the cursor definition.
The row indicated by the cursor is that retrieved by the most recent
FETCHstatement, see FETCH.After the deletion, the cursor is no longer positioned on a row in the set defined by the cursor declaration. A
FETCHstatement is required to position the cursor on the next row in the set before anotherDELETE CURRENTor anUPDATE CURRENTstatement can be executed.See ALLOCATE CURSOR for a description of extended cursors.
If an
extended-cursor-nameis specified in aDELETE CURRENTstatement, it specifies the name of a host variable whose value is the name of the cursor.Restrictions
DELETEaccess to the table or view identified bytable-nameis required when the cursor used for theDELETE CURRENTstatement is opened. IfDELETEaccess is not held, the cursor may be opened butDELETE CURRENTstatements will fail.A row indicated by a
WITH HOLDcursor must have been fetched in the same transaction.The
DELETE CURRENTstatement may not be used for read-only cursors.A cursor cannot be identified by specifying
extended-cursor-namein a procedural usage context.In a procedural usage context, the
DELETE CURRENTstatement is only permitted if the procedureaccess-clauseisMODIFIES SQL DATA, see CREATE PROCEDURE.Notes
The table name given in the
DELETE CURRENTstatement must be the same as that specified in theFROMclause of the cursor declaration. If a synonym is used in one of the statements, the same synonym must also be used in the other.If the table name addressed by the
DELETE CURRENTstatement is subject to any referential constraints, the delete operation must not create a situation where these constraints are violated. The effect of the delete operation on any referential constraints depends on thedelete-rulein effect for each constraint, see CREATE TABLE for a description of thedelete-ruleoptions.If an error occurs during execution of a
DELETE CURRENTstatement, the row is not deleted.Example
exec sql FETCH cur1 INTO :ival; if (ival < 0) { exec sql DELETE FROM tab1 WHERE CURRENT OF cur1; ... } else...Standard Compliance
|
Mimer Information Technology AB Voice: +46 18 780 92 00 Fax: +46 18 780 92 40 info@mimer.se |
|
|