PL/SQL Function

Saggi
Saggi used Ask the Experts™
on
I need a PL/SQL function, that function should wait/sleep for 5 minutes and continue for further execution.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2011
Top Expert 2012
Commented:

already available

dbms_lock.sleep(300)
HainKurtSr. System Analyst

Commented:
why do you need such thing? you should find other way to run something in 5 minutes...
Top Expert 2009

Commented:
If the job is running from the scheduler, there is nothing inherently wrong with sleeping the job for 5 minutes, as long as you aren't holding down table locks that will affect other users. It is not a busy wait, doesn't consume CPU, and is there in the API for good reason.

Commented:
execute sys.dbms_lock.sleep(5);

Commented:
Please ignore my previous comment,This should be 5 minutes
execute sys.dbms_lock.sleep(300);
Commented:
- You should have execute privilege on dbms_lock package from SYS.
- There is public synonym available for DBMS_LOCK. So no need to write SYS.DBMS_LOCK
DBMS_LOCK.SLEEP(5)

Open in new window


Also you can install USER_LOCK package and call
USER_LOCK.SLEEP

Open in new window

.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial