Oracle Database - SELECT … FOR UPDATE statement


The SELECT … FOR UPDATE statement is a special type of SELECT statement that does lock the row that it is reading.

It's the only exception where a reader can blocks a writer.

In SQL, a result table is retrieved through a cursor that is named. The current row of a result set can be updated or deleted using a positioned update/delete statement that references the cursor name. To insure that the cursor has the proper isolation level to support update, the cursor's SELECT statement should be of the form SELECT FOR UPDATE. If FOR UPDATE is omitted, the positioned updates may fail.


The JDBC API supports this SQL feature by providing the name of the SQL cursor used by a ResultSet object. See function getCursorName() The current row of a ResultSet object is also the current row of this SQL cursor.

Documentation / Reference

Powered by ComboStrap