Enterprise Edition Home | Express Edition Home | Previous Page | Next Page   SQL Statements > DELETE >

Using the WHERE CURRENT OF Keywords (ESQL/C, SPL)

The WHERE CURRENT OF clause deletes the current row of the active set of a cursor. When you include this clause, the DELETE statement removes the row of the active set at the current position of the cursor. After the deletion, no current row exists; you cannot use the cursor to delete or update a row until you reposition the cursor with a FETCH statement.

You access the current row of the active set of a cursor with an update cursor. Before you can use the WHERE CURRENT OF clause, you must first create an update cursor by using the FOREACH statement (SPL) or the DECLARE statement with the FOR UPDATE clause (ESQL/C).

Unless they are declared with the FOR READ ONLY keywords, all select cursors are potentially update cursors in an ANSI-compliant database. You can use the WHERE CURRENT OF clause with any select cursor that was not declared with the FOR READ ONLY keywords.

In Dynamic Server, you cannot use WHERE CURRENT OF if you are selecting from only one table in a table hierarchy. That is, this clause is not valid with the ONLY keyword.

The WHERE CURRENT OF clause can be used to delete an element from a collection by deleting the current row of the collection-derived table that a collection variable holds. For more information, see Collection-Derived Table.

Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]