Hi Bill,

The FOR UPDATE clause syntax allows for the possibility of column-level locking, but 
Oracle only implements row-level
locking. So the OF <column_name> phrase is just ignored.

@   Regards,
@   Steve Adams
@   http://www.ixora.com.au/
@   http://www.christianity.net.au/


-----Original Message-----
Sent: Saturday, 6 October 2001 2:40
To: Multiple recipients of list ORACLE-L




Why does the following work?  I open a cursor with FOR UPDATE OF COLUMN_A
and then do an update of COLUMNB, WHERE CURRENT OF the cursor.  Surely I
shouldn't be allowed to do that?
(Ora 8.1.7.2)

Any insight appreciated!
Thanks
- Bill.


SQLWKS> create table test_table
      2> (
      3> column_a        number,
      4> column_b        number
      5> )
      6>
Statement processed.
SQLWKS> insert into test_table values (1,2)
      2>
1 row processed.
SQLWKS> insert into test_table values (2,3)
      2>
1 row processed.
SQLWKS> insert into test_table values (3,4)
      2>
1 row processed.
SQLWKS> declare
      2>         cursor c1 is select * from test_table for update of column_a;
      3> begin
      4>         for i in c1 loop
      5>                 update test_table set column_b = column_b * 2
      6>                 where current of c1;
      7>         end loop;
      8> end;
      9>
Statement processed.
SQLWKS> select *
      2> from test_table
      3>
COLUMN_A   COLUMN_B
---------- ----------
          1          4
          2          6
          3          8
3 rows selected.


--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Bill Buchan
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Steve Adams
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to