Too late, I'm done with it. :) Jared
On Sunday 03 November 2002 18:53, Babette Turner-Underwood wrote: > One other suggestion .... > > If you know what time you want to sleep until, why not just write the > accu_sleep procedure to accept time to sleep and have it calculate how many > chunks, etc it needs (rather than calculate seconds and then use the > seconds)?? > > - - - Psuedo code: - - - > declare > time_to_sleep_to date := trunc(sysdate) + 10/24; > begin > sleep_until (time_to_sleep_to); > end; > / > > and re-write accusleep (or encapsulate it into sleep_until) > > -----Original Message----- > [EMAIL PROTECTED] > Sent: Friday, November 01, 2002 1:19 PM > To: Multiple recipients of list ORACLE-L > > > > > Here is a working version of accusleep if anyone > is interested. I ran a test to sleep for about > 65 minutes, and the result was within 1 second > of the target time. > > 08:56:25 rsysdevdb.radisys.com - jkstill@dv01 SQL> @accusleep > > Procedure created. > > 08:56:28 rsysdevdb.radisys.com - jkstill@dv01 SQL> @accutest > 3809 > > PL/SQL procedure successfully completed. > > 09:59:59 rsysdevdb.radisys.com - jkstill@dv01 SQL> > > Here is the procedure: > ---------------------------------------------------------------------- > create or replace procedure accusleep ( seconds_in number ) > is > v_chunk_size constant integer := 100; > v_compensation constant number := 0.976; > v_chunks integer; > v_remainder integer; > v_seconds integer; > begin > v_seconds := seconds_in * v_compensation; > v_chunks := trunc(v_seconds/v_chunk_size); > v_remainder := mod(v_seconds, v_chunk_size); > > for i in 1..v_chunks > loop > dbms_lock.sleep(v_chunk_size); > end loop; > dbms_lock.sleep(v_remainder); > > --dbms_output.put_line(v_chunks); > --dbms_output.put_line(v_remainder); > > end; > / > ---------------------------------------------------------------------- > > Here is the test: > > > declare > seconds integer; > begin > -- seconds from now til 10:00 AM > select (to_date(trunc(sysdate)+(10/24)) - sysdate ) * ( 24*60*60) into > seconds > from dual; > dbms_output.put_line(seconds); > accusleep(seconds); > end; > / > > > Jared > > > -- > Please see the official ORACLE-L FAQ: http://www.orafaq.com > -- > Author: > INET: [EMAIL PROTECTED] > > Fat City Network Services -- 858-538-5051 http://www.fatcity.com > San Diego, California -- Mailing list and web hosting services > --------------------------------------------------------------------- > To REMOVE yourself from this mailing list, send an E-Mail message > to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in > the message BODY, include a line containing: UNSUB ORACLE-L > (or the name of mailing list you want to be removed from). You may > also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Jared Still INET: [EMAIL PROTECTED] Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
