使用私有软件包调用数据库过程
答案 0 :(得分:4)
如果是私有的,则表示在包主体中定义但未在标头中公开的过程,则否。另一个软件包将无法“查看”该过程。
SQL> CREATE OR REPLACE PACKAGE foo AS END; -- No "public" procedures/functions
2 /
Package FOO compiled
SQL> CREATE OR REPLACE PACKAGE BODY foo
2 AS
3 PROCEDURE priv IS BEGIN NULL; END; -- "Private" procedure
4 END;
5 /
Package Body FOO compiled
SQL> CREATE OR REPLACE PACKAGE other_pkg
2 AS
3 PROCEDURE call_priv_proc;
4 END;
5 /
Package OTHER_PKG compiled
SQL> CREATE OR REPLACE PACKAGE BODY other_pkg
2 AS
3 PROCEDURE call_priv_proc
4 IS
5 BEGIN
6 foo.priv;
7 END;
8 END;
9 /
Package Body OTHER_PKG compiled
LINE/COL ERROR
--------- -------------------------------------------------------------
6/5 PL/SQL: Statement ignored
6/9 PLS-00302: component 'PRIV' must be declared
Errors: check compiler log
如果使用数据库过程,是指不在软件包中的独立过程,则是-前提是调用方对该过程具有EXECUTE权限。程序是使用Invoker还是Definer的权限定义的也很重要。参见Invokers and Definers Rights