Oracle Database - SELECT FOR UPDATE statement

Card Puncher Data Processing

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.

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.

Documentation / Reference





Discover More
Toad Lock
Oracle Database - Locks

Lock Mechanism in Oracle Oracle Database provides: data concurrency, consistency. The data a session is viewing or changing must not be changed by other sessions until the user is finished. and...
Oracle Database Row Lock Tx
Oracle Database - Row Locks (TX)

A row lock, also called a TX lock, is a lock on a single row of table. A transaction acquires a row lock for each row modified by an INSERT, UPDATE, DELETE, MERGE, or SELECT ... FOR UPDATE statement. The...
Card Puncher Data Processing
Oracle Database - Table Lock (TM)

A table lock, also called a TM lock, is acquired by a transaction when a table is modified by an: INSERT, UPDATE, DELETE, MERGE, SELECT with the FOR UPDATE clause, or LOCK TABLE statement....



Share this page:
Follow us:
Task Runner