Sleep function in ORACLE
Posted
by Salvador
on Stack Overflow
See other posts from Stack Overflow
or by Salvador
Published on 2010-04-01T15:45:39Z
Indexed on
2010/04/01
16:33 UTC
Read the original article
Hit count: 533
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_ IN NUMBER
)
RETURN INTEGER IS
BEGIN
DBMS_LOCK.sleep(seconds => TIME_);
RETURN 1;
EXCEPTION
WHEN OTHERS THEN
RAISE;
RETURN 1;
END TEST_SLEEP;
and i call in this way
SELECT TEST_SLEEP(10.5) FROM DUAL
but to work i need set grant of DBMS_LOCK to the owner of the procedure.
how i can rewrite this function without using the DBMS_LOCK.sleep
function?
Thanks in advance.
© Stack Overflow or respective owner