sleep command in plsql

is there sleep command in plsql?
wabby26Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mszacikCommented:
There is a procedure called SLEEP in the SYS.DBMS_LOCK package that you can use.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
psmith789Commented:
Not as such.

You could create a stored procedure that would take as an argument how long you wanted to wait, which would note the SYSDATE value when it started and then ran a WHILE loop until the designated time came.

The date/time manipulation might be a bit tricky (as it often is in Oracle), but this should work.

If this does it for you, please accept the comment as the answer. Otherwise, good luck!
0
Mark GeerlingsDatabase AdministratorCommented:
Not directly, but you can use the dbms_pipe package to get the effect.  The receive_message function in that package has a timeout parameter (in seconds I think) so this should give you a 20-second "sleep" time:

declare
  dummy integer;
begin
  dbms_output.put_line('Started at '||to_char(sysdate,'HH24:MI:SS'));
  dummy := dbms_pipe.receive_message('waitpipe',20);
  dbms_output.put_line('Ended at   '||to_char(sysdate,'HH24:MI:SS'));
end;
/

Notes: the "dbms_output.put_line" commands just give you visual confirmation for testing.  Remember to "set serveroutput on" in SQL*Plus first.
0
mszacikCommented:
There is a procedure called SLEEP in the SYS.DBMS_LOCK package you can use.  You pass in the seconds you want execution suspended.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.