Oracle 12.2
I have a procedure that may be called by multiple sessions at once but I only want 1 to be working at a time, how can I build a lock into a procedure call so that a session will wait until the lock is free before proceeding.
Something like
create or replace procedure my_proc
as
begin
while tab_lock is true
loop
check tab_lock if true then loop;
else
exit;
end loop;
tab_lock = true;
do something;
tab_lock = false;
end;
I dont mind if several proc calls are in that loop, I just need it so only 1 is working at a time. Anyone know?