为什么匿名oracle存储过程正在工作但命名不行

时间:2017-07-19 10:09:04

标签: oracle stored-procedures

我试图在Oracle 11.2.0.4.0中创建一个简单的SP,它将执行一个简单的更新语句,如

update t set col1 = 1 where col2 = 2;

当我在匿名存储过程中执行此操作时,它可以正常工作

begin
     update t set col1 = 1 where col2 = 2;
end;

但如果我试图创建一个程序

create or replace procedure p as 
begin
     update t set col1 = 1 where col2 = 2;
end;

试图运行它,我得到了很多错误:

ORA-06550: line 9, column 13:
PLS-00201: identifier 'SYS.DBMS_SQL' must be declared
ORA-06550: line 9, column 13:
PL/SQL: Item ignored
ORA-06550: line 16, column 13:
PLS-00201: identifier 'SYS.DBMS_LOB' must be declared
ORA-06550: line 16, column 13:
PL/SQL: Item ignored

任何人都可以解释它是如何发生的,为什么sp试图从SYS模式中获取对象?为什么它在匿名sp的情况下工作而在命名SP的情况下不起作用?

0 个答案:

没有答案