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

Home -> Community -> Usenet -> c.d.o.server -> Re: Delay or Wait function call in PL/SQL

Re: Delay or Wait function call in PL/SQL

From: Arjan van Bentem <avbentem_at_DONT-YOU-DAREdds.nl>
Date: 1998/08/12
Message-ID: <6qskba$74e$1@newton.a2000.nl>#1/1

Try

  dbms_lock.sleep(5);

or use (taken from some Oracle docs):

  function sleep( p_SleepSec in number default 60

                , p_PipeName  in varchar2 default null
                ) return number

  is
    v_StartTime   number(30);
    v_EndTime     number(30);
    v_PipeStatus  integer;
    v_PipeName    varchar2(128) := p_PipeName;
  begin
    if ( p_PipeName is null ) then

       v_PipeName := concat(dbms_pipe.unique_session_name, 'LucentSleep');     end if;
    v_StartTime := to_number( ((to_char(sysdate, 'J') - 1 ) * 86400) +

                               to_char(sysdate, 'SSSSS')
                            );

    v_PipeStatus := dbms_pipe.receive_message(v_PipeName, p_SleepSec);     v_EndTime := to_number( ((to_char(sysdate, 'j') - 1 ) * 86400) +
                            to_char(sysdate, 'sssss')
                          );
    if ( v_PipeStatus = 1 ) then
       return(0);
    else
       return(p_SleepSec - (v_EndTime - v_StartTime));
    end if;
  end sleep;

The latter has the capability to terminate the sleep by sending a message over the named pipe.

Arjan.

> Is there any way to call a delay or wait function call inside PL/SQL
>to make a procedure or function sleep await e.g. 5 sec before execute
>next statement.
Received on Wed Aug 12 1998 - 00:00:00 CDT

Original text of this message

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