Apr 20, 2007 #1 djtom2000 Programmer Joined Feb 2, 2002 Messages 13 Location 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
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
Apr 20, 2007 #2 SantaMufasa Technical User Joined Jul 17, 2003 Messages 12,588 Location US 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. Mufasa (aka Dave of Sandy, Utah, USA) [I provide low-cost, remote Database Administration services: www.dasages.com] Upvote 0 Downvote
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. Mufasa (aka Dave of Sandy, Utah, USA) [I provide low-cost, remote Database Administration services: www.dasages.com]