Using DBMS_LOCK in function gives error
470436May 20 2009 — edited May 20 2009Dear Guru's
I need to use the DBMS_LOCK.sleep. Hence to get more info i searched the forum and I found this code from the forum
CREATE OR REPLACE
FUNCTION sleep (secs_in IN INTEGER) RETURN NUMBER
is
BEGIN
DBMS_LOCK.sleep(secs_in);
RETURN secs_in;
END;
and tried it in my envrionment..
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options
SQL*Plus: Release 10.1.0.4.2
Warning: Function created with compilation errors.
SQL> show errors
Errors for FUNCTION SLEEP:
LINE/COL ERROR
-------- -----------------------------------------------------------------
4/5 PL/SQL: Statement ignored
4/5 PLS-00201: identifier 'DBMS_LOCK' must be declared
I tried using the DBMS_LOCK in a Nameless procedure like this
begin
dbms_lock.sleep(5);
end;
there was no error message and i got a message that it has been executed successfully
I tried it similarly in a stored procedure , then also i got the same error message
Please enlighten me on this issue.
with warm regards
ssr