Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How to ensure only one session runs PL/SQL proc at a time?
Have a look at the dbms_lock package.
It exposes the normal enqueue mechanism
to PL/SQL and allows you to take out 'UL'
locks - but I think it has one extra special
feature that you can define a lock to stay
held across commits until explicitly released.
-- Jonathan Lewis Host to The Co-Operative Oracle Users' FAQ http://www.jlcomp.demon.co.uk/faq/ind_faq.html Author of: Practical Oracle 8i: Building Efficient Databases See http://www.jlcomp.demon.co.uk/book_rev.html For latest news of public appearances See http://www.jlcomp.demon.co.uk Screen saver or Life saver: http://www.ud.com Use spare CPU to assist in cancer research. Peter Marshall wrote in message <9m2ge2$u4i$1_at_news.x-echo.com>...Received on Thu Aug 23 2001 - 04:13:14 CDT
>Does anyone know of an easy way to do this? I have a PL/SQL procedure co
>mpiled in a package. I want to make sure that two sessions can't be runn
>ing the procedure at the same time. It should work just like a database
>resource lock -- the second comer waits until the first one is finished,
> then it can run the procedure.
>
>I thought of using a lock on a database object (eg. the procedure tries
>to take exclusive lock on a table, then release it at the end of the pro
>cedure). But this wouldn't work, since I do DDL during the procedure, wh
>ich would release the lock...
>
>I have looked around the manuals and thought about it, but nothing comes
> to mind. Does anyone have a good solution for this?
>
>Thanks and regards,
>Peter
>
>
>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>Article poste via Voila News - http://www.news.voila.fr
>Le : Thu Aug 23 10:55:30 2001 depuis l'IP : 195.15.152.196 [VIP 1597792]