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

Home -> Community -> Usenet -> c.d.o.tools -> Re: selecting non-locked rows

Re: selecting non-locked rows

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Fri, 30 Mar 2001 19:49:39 +0800
Message-ID: <3AC472D3.4463@yahoo.com>

xmark.powell_at_eds.com.x wrote:
>
> In article <9a20ph$3ci63$1_at_ID-37725.news.dfncis.de>, steno
> <snovotny_at_integro.net> writes:
> >hi there,
> >
> >i'm searching for a way to select all rows that are not locked by another
> >session/select for update.
> >anyone knows how i can do that?
> >
> >thanx in advance
> >steno
> >
> You can add the nowait parameter to a select for update in version 8+. I can
> not remember when this was added to sql; it existed in pl/sql before if was
> added to regular sql. However, from the manual if appears the sql statement
> is cancelled if a locked row is encountered so it would appear you would need
> to use a cursor in pl/sql to process the rows:
>
> cursor to select rows
> loop
> fetch row in cursor
> perform select for update nowait on cursor row
> if returned process
> else nowait condition detected skip
> end if
> end loop
>
> -- Mark D. Powell --
>
> ----- Posted via NewsOne.Net: Free (anonymous) Usenet News via the Web -----
> http://newsone.net/ -- Free reading and anonymous posting to 60,000+ groups
> NewsOne.Net prohibits users from posting spam. If this or other posts
> made through NewsOne.Net violate posting guidelines, email abuse_at_newsone.net

Also there is

select * from ... for update skip locked;

hth
connor

-- 
===========================================
Connor McDonald
http://www.oracledba.co.uk (mirrored at
http://www.oradba.freeserve.co.uk)

"Some days you're the pigeon, some days you're the statue"
Received on Fri Mar 30 2001 - 05:49:39 CST

Original text of this message

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