Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to 'wait' in SQL plus

4,226 views
Skip to first unread message

Alan

unread,
Aug 11, 2004, 2:37:45 PM8/11/04
to
What's the Oracle SQLPlus command to 'wait' for a particular period of
time (e.g. 10 seconds) before the next statement/command run?

zeb

unread,
Aug 11, 2004, 2:47:06 PM8/11/04
to

> What's the Oracle SQLPlus command to 'wait' for a particular period of
> time (e.g. 10 seconds) before the next statement/command run?

see dbms_lock.sleep
HTH


Yong Huang

unread,
Aug 12, 2004, 3:00:12 PM8/12/04
to
"zeb" <sp...@nowhere.com> wrote in message news:<411a6933$0$26984$626a...@news.free.fr>...

Just for the record. (Credit to Jonathan Lewis) dbms_lock.sleep has a
small error in case you need it to be accurate. When you
dbms_lock.sleep(1000), it really sleeps 1024 seconds (if I remember
right). I just did a test on my 9.0.1 database running on Windows
2000, sleep(100) took 104 seconds. But my measurement is not very
scientific.

Also, if you use 8i, read Metalink Note:187528.1 for errors when sleep
time exceeds 4164 seconds.

Yong Huang

Alan

unread,
Aug 12, 2004, 7:35:26 PM8/12/04
to
yon...@yahoo.com (Yong Huang) wrote in message news:<b3cb12d6.04081...@posting.google.com>...


So there is no single command like 'wait' or 'timeout' or simple things like that?
> Yong Huang

Prem K Mehrotra

unread,
Aug 12, 2004, 9:45:47 PM8/12/04
to
yon...@yahoo.com (Yong Huang) wrote in message news:<b3cb12d6.04081...@posting.google.com>...

You could also use OS command inside sql*plus, e.g., on UNIX:

sqlplus user/passwd
select * from tab1;
host sleep 60
select * from tab2
quit

will sleep for 60 secodns between first and second select

Prem

Mark Bole

unread,
Aug 12, 2004, 11:29:20 PM8/12/04
to
Alan wrote:

Yes, it is very simple, one single command, as reading the documentation
for the suggestion above would show:

SQL> select to_char(sysdate, 'HH24:MI') from dual;

TO_CH
-----
20:25

SQL> exec DBMS_LOCK.SLEEP(120);

PL/SQL procedure successfully completed.

SQL> select to_char(sysdate, 'HH24:MI') from dual;

TO_CH
-----
20:27

--Mark Bole

Yong Huang

unread,
Aug 13, 2004, 10:18:31 AM8/13/04
to
desertf...@yahoo.com (Alan) wrote in message news:<b1217045.0408...@posting.google.com>...

As Prem pointed out, you could temporarily exit to the UNIX shell (or
DOS) and run the sleep command there. There're many sleep.exe or
timeout.exe implementations on the Internet. Just make sure the
command is in your PATH. But it's just as easy to type exec
dbms_lock.sleep(10) at SQLPLUS> prompt. And you can use this in PL/SQL
too (just drop exec).

Yong Huang

0 new messages