WHERE CURRENT OF clause

The WHERE CURRENT OF clause is a clause in some UPDATE and DELETE statements. It allows you to perform positioned updates and deletes on updatable cursors. Updatable and/or scrollable JDBC ResultSets can provide a simpler and easier way to perform these tasks.

For more information about updatable cursors, see SELECT statement. For information on scrollable and updatable ResultSets, see the Java SE API documentation on the java.sql.ResultSet interface as well as the information on the Derby implementation at java.sql.ResultSet interface.

Syntax

WHERE CURRENT OF cursorName

Example

conn.setAutoCommit(false);

Statement s = conn.createStatement();
s.setCursorName("AIRLINESRESULTS");
ResultSet rs = s.executeQuery(
        "SELECT Airline, basic_rate " +
        "FROM Airlines FOR UPDATE OF basic_rate");
rs.next();
Statement s2 = conn.createStatement();
s2.executeUpdate("UPDATE Airlines SET basic_rate = basic_rate " +
        "+ .25 WHERE CURRENT OF AirlinesResults");