Home » SQL & PL/SQL » SQL & PL/SQL » wait for database entry in pl/sql
wait for database entry in pl/sql [message #35846] Fri, 19 October 2001 03:47 Go to next message
Mathias
Messages: 3
Registered: October 2001
Junior Member
Hello,

does anybody have an example of a script that waits until a specific entry exits in the database?
I need to run some scripts after an external process has updated/added one entry in the database.
I want to run a script that looks for this entry and if it is not there sleeps for 15 Minutes before looking again.

Any ideas?
Thanks in advance,
Mathias

----------------------------------------------------------------------
Re: wait for database entry in pl/sql [message #35847 is a reply to message #35846] Fri, 19 October 2001 05:30 Go to previous message
jim
Messages: 74
Registered: July 2000
Member
I think you are looking for something like this. You can put this code in your procedure or create a stand alone procedure.

create or replace procedure jims_wait_procedure ( p_variable_flag varchar2,
p_variable_time number)
as
t_temp varchar2(1);
t_trigger_boolean boolean := false;
cursor check_for_trigger is
select '1'
from jims_temp
where column1 = p_variable_flag;
Begin
while not t_trigger_boolean
loop
open check_for_trigger;
fetch check_for_trigger into t_temp;
if check_for_trigger%found then
t_trigger_boolean := true;
else
dbms_lock.sleep(p_variable_time);
end if;
close check_for_trigger;
end loop;
end;

----------------------------------------------------------------------
Previous Topic: (Urgent !!!) Row to column
Next Topic: Day Of Week Isolation
Goto Forum:
  


Current Time: Thu Mar 28 05:22:13 CDT 2024