Sleep function in ORACLE

后端 未结 11 1900
一整个雨季
一整个雨季 2020-11-30 00:52

I need execute an SQL query in ORACLE it takes a certain amount of time. So I wrote this function:

CREATE OR REPLACE FUNCTION MYSCHEMA.TEST_SLEEP
(
TIME_  I         


        
11条回答
  •  情深已故
    2020-11-30 01:17

    You can use DBMS_PIPE.SEND_MESSAGE with a message that is too large for the pipe, for example for a 5 second delay write XXX to a pipe that can only accept one byte using a 5 second timeout as below

    dbms_pipe.pack_message('XXX');
    dummy:=dbms_pipe.send_message('TEST_PIPE', 5, 1);

    But then that requires a grant for DBMS_PIPE so perhaps no better.

提交回复
热议问题