如何让 PLJSON 与其他用户一起工作

How to get PLJSON working with other users

我刚刚安装了最新版本的PLJSON version 2.5.4

我在 sys 用户下成功地在 oracle 上安装了软件包,没有错误,但是其他用户无法访问 PLJSON,例如 运行 测试示例 sql 文件。

运行 作为 sys/sysdba

SQL> connect sys@backup as sysdba
Enter password: ********
Connected.
SQL> @C:\sql\pljson-3.6.1\examples\ex12.sql
"true"
"true"
"true"

PL/SQL procedure successfully completed.

运行 它来自不同的用户结果

SQL> connect orders@backup
Enter password: *****
Connected.
SQL> @C:\sql\pljson-3.6.1\examples\ex12.sql
  obj pljson;
      *
ERROR at line 2:
ORA-06550: line 2, column 7:
PLS-00201: identifier 'PLJSON' must be declared
ORA-06550: line 2, column 7:
PL/SQL: Item ignored
ORA-06550: line 4, column 3:
PLS-00320: the declaration of the type of this expression is incomplete or
malformed
ORA-06550: line 4, column 3:
PL/SQL: Statement ignored
ORA-06550: line 6, column 24:
PLS-00201: identifier 'PLJSON_PRINTER.PRETTY_PRINT_ANY' must be declared
ORA-06550: line 6, column 3:
PL/SQL: Statement ignored
ORA-06550: line 8, column 24:
PLS-00201: identifier 'PLJSON_EXT.PP' must be declared
ORA-06550: line 8, column 3:
PL/SQL: Statement ignored
ORA-06550: line 10, column 17:
PLS-00320: the declaration of the type of this expression is incomplete or
malformed
ORA-06550: line 10, column 3:
PL/SQL: Statement ignored

我怎样才能得到它以便所有用户都可以访问它。

我从未使用过它,但是 - 通常可以通过向其他用户授予权限来解决此类问题 - 甚至 public。例如(以 SYS 身份连接并假定包名称为 pljson

grant execute on pljson to public;

create public synonym pljson for pljson;

然后您将再次连接为 orders 和 运行

@C:\sql\pljson-3.6.1\examples\ex12.sql