Mimer SQL Documentation TOC PREV NEXT INDEX

Mimer SQL Developer Site


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 FETCH statement, see FETCH.

After the deletion, the cursor is no longer positioned on a row in the set defined by the cursor declaration. A FETCH statement is required to position the cursor on the next row in the set before another DELETE CURRENT or an UPDATE CURRENT statement can be executed.

See ALLOCATE CURSOR for a description of extended cursors.

If an extended-cursor-name is specified in a DELETE CURRENT statement, it specifies the name of a host variable whose value is the name of the cursor.

Restrictions

DELETE access to the table or view identified by table-name is required when the cursor used for the DELETE CURRENT statement is opened. If DELETE access is not held, the cursor may be opened but DELETE CURRENT statements will fail.

A row indicated by a WITH HOLD cursor must have been fetched in the same transaction.

The DELETE CURRENT statement may not be used for read-only cursors.

A cursor cannot be identified by specifying extended-cursor-name in a procedural usage context.

In a procedural usage context, the DELETE CURRENT statement is only permitted if the procedure access-clause is MODIFIES SQL DATA, see CREATE PROCEDURE.

Notes

The table name given in the DELETE CURRENT statement must be the same as that specified in the FROM clause 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 CURRENT statement 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 the delete-rule in effect for each constraint, see CREATE TABLE for a description of the delete-rule options.

If an error occurs during execution of a DELETE CURRENT statement, 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

Standard
Compliance
Comments
SQL-2011
Core
Fully compliant.


Mimer
Mimer Information Technology AB
Voice: +46 18 780 92 00
Fax: +46 18 780 92 40
info@mimer.se
Mimer SQL Documentation TOC PREV NEXT INDEX