Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Time Delay

Status
Not open for further replies.

djtom2000

Programmer
Feb 2, 2002
13
0
0
GB
Hi,

I need to execute one SQL statement (an insert for example) then wait for a period of time then execute a second SQL statement (another insert).

Is there anyway of doing this? The code that I currently have is within a trigger.

Thanks
 
What code are you using in the trigger to effect the delay?

If this delay should occur within a PL/SQL block (including triggers), then the code for a 15-second delay (without burning any CPU seconds) is:
Code:
DECLARE
...
BEGIN
    ...
    INSERT...
    DBMS_LOCK.SLEEP(15);
    INSERT...
    ...
END;
/
If the delay is in a plain SQL-only script then you can say:
Code:
INSERT...
EXEC DBMS_LOCK.SLEEP(15)
INSERT...
Let us know if this satisfies your need.


[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[I provide low-cost, remote Database Administration services: www.dasages.com]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top