New security enhancement has been introduced in Oracle 12c that will implement “white listing” on the PL/SQL code that will provide an isolation level.
The new keyword ACCESSIBLE BY can be used with the following database objects only: function, package, procedure, and type.
To illustrate… I have created the following 2 packages under DUMMY_TEST schema:
CREATE OR REPLACE PACKAGE dummy1_pkg
IS
PROCEDURE do_action1;
END;
/
CREATE OR REPLACE PACKAGE BODY dummy1_pkg
IS
PROCEDURE do_action1
IS
BEGIN
dummy2_pkg.do_action2;
dummy2_pkg.do_action3;
END;
END;
/
CREATE OR REPLACE PACKAGE dummy_test.dummy2_pkg
ACCESSIBLE BY (dummy1_pkg)
IS
PROCEDURE do_action2;
PROCEDURE do_action3;
END;
/
CREATE OR REPLACE PACKAGE BODY
dummy2_pkg
IS
PROCEDURE do_action2
IS
BEGIN
DBMS_OUTPUT.put_line (‘Hi Action 2’);
END;
PROCEDURE do_action3
IS
BEGIN
DBMS_OUTPUT.put_line (‘Hi Action 3’);
END;
END;
/
I was able to execute dummy1 package with no problems as shown below, by executing:
BEGIN
dummy1_pkg.do_action1;
END;
/
When I try to directly execute the other package dummy2_pckg by executing the query:
BEGIN
dummy2_pkg.do_action2;
END;
/
The following error is thrown: PLS-00904: insufficient privilege to access object DUMMY2_PKG
Remark: you can specify a package or a procedure in the accessible by clause while even if this package/procedure is not yet created, so you will not face any errors at compilation time.
[…] ACCESSIBLE BY in Oracle 12c PL/SQL […]
Good Article
Thanks