Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: NOWAIT for row-level lock?

Re: NOWAIT for row-level lock?

From: Avion Consulting & Services <a_at_b.com>
Date: Sat, 24 Oct 1998 01:18:42 +1000
Message-ID: <36309f08.0@pink.one.net.au>


This should be possible in PL/sql. Heres how:

DECLARE
    xxx exception;
    pragma exception ( -nnnn, xxx ); ( Check the syntax for pragmas in the pl/sql ref );

    /* nnnn is the error number that shows up when you attempt to lock a row that has been locked. Cant think of this off my top. The foll should provide this : lock table xxx in exclusive mode; From another sql session issue the same command with nowait. The error that comes up is what you are looking at trapping

   */
BEGIN
    for c1_rec in ( select * from dept for update nowait ) loop

   .....
    end loop;
EXCEPTION
    when xxx then do what you want to do END; Sridhar Subramaniam

gcunning_at_my-dejanews.com wrote in message <70q458$elv$1_at_nnrp1.dejanews.com>...
>Is there a way to NOT wait for a row -level lock held by another
transaction?
>
>For instance, if:
>
>txn1 selects row 1 for update at a point in time. At a later time, txn2
>selects the same row for update, but txn1 still holds the lock (txn1 hasn't
>commited).
>
>Instead of waiting, is there a way to let txn2 know that the record is
locked,
>so they can move on to another record?
>
>
>Thanks,
>
>Jerry
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Received on Fri Oct 23 1998 - 10:18:42 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US