当我执行“dbms_lock.sleep”时,它成功运行。但是,当我把它放在一个过程中然后抛出错误就像'标识符'DBMS_LOCK必须声明''
exec dbms_lock.sleep ( 5 ); -- this is working
create procedure p1
...
dbms_lock.sleep ( 5 ); -- Error(264,2): PLS-00201: identifier 'DBMS_LOCK' must be declared
...
end;
/
以下内容来自dba_objects:
SYS DBMS_LOCK PACKAGE BODY
SYS DBMS_LOCK PACKAGE
PUBLIC DBMS_LOCK SYNONYM
SYS DBMS_OUTPUT PACKAGE
PUBLIC DBMS_OUTPUT SYNONYM
SYS DBMS_OUTPUT PACKAGE BODY
答案 0 :(得分:2)
通过角色获得的权限在PL / SQL块中无效。需要直接向用户授予对包的execute
特权,例如:
grant execute on dbms_lock to your_oracle_user;