Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: How to delay the execution of an SQL statement?

Re: How to delay the execution of an SQL statement?

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Thu, 2 May 2002 15:16:03 +0100
Message-ID: <1020348978.10416.1.nnrp-14.9e984b29@news.demon.co.uk>

I think dbms_lock.sleep (or user_lock.sleep) have already been mentioned, and these
are accurate to 0.01 seconds. (Although one takes its input in seconds and the other in hundredths).

You do have to be careful about procedures that sleep and poll though - you can get caught by KGL (internal) locks if you need to recompile them or things they are dependent on. Make sure you have an even that makes them shut themselves down.

An alternative to the 'waiting cheaply' for a user event is the dbms_alert package. Your waiter could register an interest in an alert, then wait on it. Your other process could then raise an alert when it does the critical event. This may be cleaner than writing your own mechanism.

--
Jonathan Lewis
http://www.jlcomp.demon.co.uk

Author of:
Practical Oracle 8i: Building Efficient Databases

Next Seminar - Australia - July/August
http://www.jlcomp.demon.co.uk/seminar.html

Host to The Co-Operative Oracle Users' FAQ
http://www.jlcomp.demon.co.uk/faq/ind_faq.html



FC wrote in message ...


>
>Well,
>I have a similar question, I'd like to make a stored procedure enter into a
>"stand-by" state without consuming too much CPU time.
>Say for instance I am looping waiting for a user triggered event, how can I
>doze for half a second and then wake up again ?
>
>
Received on Thu May 02 2002 - 09:16:03 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US