Re: Row level locking: how to do it?

From: Thomas J. Kyte <tkyte_at_us.oracle.com>
Date: 1996/08/07
Message-ID: <3208af0f.5474051_at_dcsun4>#1/1


On Mon, 05 Aug 1996 21:23:20 -0700, Morten Kristiansen <morten.kristiansen_at_tele3.no> wrote:

>Thomas J. Kyte wrote:
>>
>> select .... from Table where rowid = :block.rowid and c1 = :block.c1 ......
>> for update nowait
>> ^^^^^^^^^^^^^^^^^
>
>OK, now you have locked the row.
>
>How long will it stay locked ? Until you manually unlock it (if so, how),
>or until you commit the update ?

Until you commit it. All locks gained in a transaction will remain in place until you commit or rollback (or issue a statement that does an implicit commit such as a DDL statement).

the ONLY exception to this are user defined locks you allocate via dbms_lock. dbms_lock allows you to gain/release named locks at will and even allows you to keep the locks across commits/rollbacks if you want.

Thomas Kyte
Oracle Government
tkyte_at_us.oracle.com                          

http://govt.us.oracle.com -- Check out our web site! Brand new, uses Oracle Web Server and Database


statements and opinions are mine and do not necessarily reflect the opinions of Oracle Corporation Received on Wed Aug 07 1996 - 00:00:00 CEST

Original text of this message