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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Determining if a record is locked

Re: Determining if a record is locked

From: Arvind Balraman <dnivra_at_ix.netcom.com>
Date: 1998/03/06
Message-ID: <350035A2.EACE11EB@ix.netcom.com>#1/1

we used a method to find out if records are locked in our procedures.

  1. use select for update witha nowait
  2. if the records are locked, it raises an exception (-51) i guess
  3. u can trap the exception in ur code using pragma exception_init
  4. do what ever u wnt 2 do in the exception handler

HTH
Arvind

Kevin P. Fleming wrote:

> Yes, you can do a SELECT ... FOR UPDATE NOWAIT on the row(s) in question. If
> the SELECT can't obtain row locks on all of the rows, it will return
> immediately and there is some way to tell if it worked, although I can't
> find it at the moment.
>
> Nuno Guerreiro wrote:
> >
> > On Wed, 04 Mar 1998 15:18:59 -0700, Kent Anderson <anderske_at_agcs.com>
> > wrote:
> >
> > >Is there a way to tell if a record is locked without
> > >actually blocking on it?
> > >
> > >My situation is that we have two processes acting
> > >on the same tables in a database. If the first process
> > >updates a record, then the second process's update on that
> > >record will block until the first process ends its
> > >transaction.
> > >
> > >Is there any way for the second process to determine
> > >if the record is locked so it can put it off until
> > >later?
> > >
> > >--
> > >+=================================================================+
> > >| Kent Anderson Phone: (602) 581-4332 |
> > >| Engineer E-mail: anderske_at_agcs.com |
> > >| AG Communications Systems |
> > >| Phoenix, Arizona "Expand the power of you network" |

 +-----------------------------------------------------------------+

> > >| Visit us on the web at http://www.agcs.com |
> > >+=================================================================+
> >
> > I'm sure an exception is raised when the second process tries to
> > update the locked record. Try to find out the name of the exception
> > and act accordingly to your needs in an exception block or write down
> > the ORA error number and test for it.
> >
> > Nuno Guerreiro
--
Balaraman Arvind
151 Andrew Ave, Apt 215
Naugatuck, CT 06770

ph   -  (203)-723-1190(R)
     -  (203)-459-7502(O)

mail -  dnivra_at_ix.netcom.com (R)
        abalaram_at_oxhp.com    (O)
Received on Fri Mar 06 1998 - 00:00:00 CST

Original text of this message

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