create table tst_table(tst_val int);
create or replace package tst_pkg as
procedure tst_insert;
end tst_pkg;
/
create or replace package body tst_pkg as
procedure tst_insert as
begin
insert into tst_table (tst_val) values (44);
end;
end tst_pkg;
/
create or replace package tst_pkg authid current_user as
procedure tst_insert;
end tst_pkg;
/
尝试执行该过程时,您将收到此错误
SQL> exec iasim.tst_pkg.tst_insert;
BEGIN iasim.tst_pkg.tst_insert; END;
*
ERROR at line 1:
ORA-00942: table or view does not exist
ORA-06512: at "IASIM.TST_PKG", line 4
ORA-06512: at line 1
1 回答
我可以想到一些可能导致这个问题的不同拓扑结构 - 我将首先从最简单的解释开始 .
如果在架构A上有表和代码(包) .
给出以下测试对象
您可以将tst_pkg上的execute授予另一个用户aka schema B,这个其他用户将能够使用tst_insert过程 - 如下所示
但是 - 如果你有这种拓扑结构,你应该使用“authid current_user”来定义你的包 - 那么授予的执行就不再足够了 .
如果您将包定义更改为
尝试执行该过程时,您将收到此错误
所以 - 如果是这种情况你应该只编译你的包没有“authid current_user”并授予用户执行权限 - 这是将行插入tst_table所需的权限我的例子,如果它是通过test_pkg中的过程完成的 .
如果这有帮助,或者如果您安排了不同的部分,请告诉我 .