Using SELECT FOR UPDATE Statement in Oracle

This Oracle tutorial explains how to use the Oracle/PLSQL SELECT FOR UPDATE assertion with syntax and examples.


The SELECT FOR UPDATE assertion permits you to lock the data in the cursor end result set. You are no longer required to make modifications to the archives in order to use this statement. The record locks are released when the next commit or rollback assertion is issued.


The syntax for the SELECT FOR UPDATE assertion in Oracle/PLSQL is:

CURSOR cursor_name
   FOR UPDATE [OF column_list] [NOWAIT];

Parameters or Arguments

cursor_name The identify of the cursor. select_statement A SELECT assertion that will populate your cursor result set. column_list The columns in the cursor result set that you want to update. NOWAIT Optional. The cursor does no longer wait for resources.


For example, you may want to use the SELECT FOR UPDATE assertion as follows:

  SELECT course_number, instructor
  FROM courses_tbl
  FOR UPDATE OF instructor;

If you design on updating or deleting data that have been referenced by means of a SELECT FOR UPDATE statement, you can use the WHERE CURRENT OF statement.