amar on web

The secret of FOR UPDATE OF clause

We specify the column names that would be updated in a cursor with the "FOR UPDATE OF" clause. Does this mean that Oracle carries out column level locking, or is there some other process triggered for the mentioned column(s)?

   cursor cr_emp is 
      select empno, ename, job, sal 
      from   emp 
      where  deptno = 'SOFTWARE' 
      for    update of sal;    -- what is the importance of putting column name over here? 

  1. For multiple tables in the cursor, the columns in the 'FOR UPDATE OF' clause specify which tables' rows are going to be locked. Omitting this clause will lock the selected rows from all the tables in the query.
  2. For a single table in the cursor, the columns in the 'FOR UPDATE OF' clause are not significant.
Specifying the column name is a good programming practice, since it points out what column is intended to be updated later in the code. Moreover, this would reduce the impact in case oracle decides to make this mandatory in future releases, or enhances this option.

Best viewed in medium text size. Please refresh this page (F5) to view the latest information.
This page was created on 15-dec-2000 and last updated on 15-dec-2000.
please forward all queries to amar_padhi@fastmail.fm