Oracle Database - SELECT ... FOR UPDATE statement

1 - About

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.

3 - JDBC API

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.

4 - Documentation / Reference

db/oracle/select_for_update.txt · Last modified: 2018/10/19 10:29 by gerardnico