views:

188

answers:

2

Hello,

I have a procedure and i would like that only one user could execute this procedure at same time.

How i can do it?

A lot of thanks!

Regards

Marc

+7  A: 

This is just off the top of my head: Consider using a named lock via dbms_lock. http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28419/d_lock.htm#CHDICHDC

Right after the begin statement get the lock, do the work, then release it on exit (Keep errors/exceptions in mind!).

KT

Karl T.
I've used this method before, it works nicely - http://jeffkemponoracle.blogspot.com/2005/10/user-named-locks-with-dbmslock.html
Jeffrey Kemp
A: 

A simple solution can be to use lock at the table level, by using FOR UPDATE.

Mudit