FOR UPDATE clause The FOR UPDATE clause is an optional part of a SELECT statement. FOR UPDATE clause cursors in-place updates

Cursors are read-only by default. The FOR UPDATE clause specifies that the cursor should be updatable, and enforces a check during compilation that the SELECT statement meets the requirements for an updatable cursor. For more information about updatability, see .

Syntax FOR { READ ONLY | FETCH ONLY | UPDATE [ OF simpleColumnName [ , simpleColumnName ]* ] }

simpleColumnName refers to the names visible for the table specified in the FROM clause of the underlying query.

Instead of FOR UPDATE, you can specify FOR READ ONLY or its synonym, FOR FETCH ONLY, to indicate that the result set is not updatable.

The use of the FOR UPDATE clause is not mandatory to obtain an updatable JDBC ResultSet. As long as the statement used to generate the JDBC ResultSet meets the requirements for updatable cursor, it is sufficient for the JDBC Statement that generates the JDBC ResultSet to have concurrency mode ResultSet.CONCUR_UPDATABLE for the ResultSet to be updatable.

The optimizer is able to use an index even if the column in the index is being updated.

For information about how indexes affect performance, see .

Example SELECT RECEIVED, SOURCE, SUBJECT, NOTE_TEXT FROM SAMP.IN_TRAY FOR UPDATE