The FOR UPDATE clause is an optional part of a SELECT statement. 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 Requirements for Updatable Cursors.
FOR { READ ONLY | FETCH ONLY | UPDATE [ OF Simple-column-Name [ , Simple-column-Name]* ] }
Simple-column-Name refers to the names visible for the table specified in the FROM clause of the underlying query.
The optimizer is able to use an index even if the column in the index is being updated. For more information about how indexes affect cursors, see Tuning Java DB.
SELECT RECEIVED, SOURCE, SUBJECT, NOTE_TEXT FROM SAMP.IN_TRAY FOR UPDATE