Why can't I grant exec on dbms_lock.sleep() OR create a procedure using it (but I can run it fine on its own)

Posted by Richard Green on Server Fault See other posts from Server Fault or by Richard Green
Published on 2012-09-13T16:37:47Z Indexed on 2012/09/14 15:40 UTC
Read the original article Hit count: 359

Filed under:
|

I am trying to write a small bit of PL/SQL that has a non-CPU burning sleep in it.

The following works in sqldeveloper

begin
  dbms_lock.sleep(5);
end;

BUT (as the same user), I can't do the following:

create or replace
procedure sleep(seconds in number)
is
begin
  dbms_lock.sleep(seconds);
end;

without the error "identifer "DBMS_LOCK" must be declared... Funny as I could run it without a procedure.

Just as strange, when I log in as a DBA, I can run the command

grant exec on dbms_lock to public;

and I get

ERROR at line 1:
ORA-00990: missing or invalid privilege

This is oracle version "Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production"

© Server Fault or respective owner

Related posts about oracle11g

Related posts about oraclexe