=====Oracle PL/SQL - mit "accessible by" Zugriffe in 12c auf PL/SQL einschränken===== **Aufgabe:** Ein Package mit besonderen Rechten darf NUR von einem anderen Package aus aufgerufen werden, der User darf diese Package selber nicht aufrufen. **Lösung:** Beispiel Code: ------------------- create or replace procedure execute_proc accessible by (gpi.call_proc) is begin dbms_output.put_line('-- Info :: Procedure execute_proc executed'); end; / ------------------- SQL> exec execute_proc BEGIN execute_proc; END; * ERROR at line 1: ORA-06550: line 1, column 7: PLS-00904: insufficient privilege to access object EXECUTE_PROC ------------------- create or replace procedure call_proc is begin execute_proc; end; / ------------------- SQL> set serveroutput on SQL> exec call_proc; -- Info :: Procedure execute_proc executed PL/SQL procedure successfully completed. Nun kann execute_proc nur noch von der Procedure call_proc aufgerufen werden. Aber! Beachten! Aus der Doku: The ACCESSIBLE BY clause allows access only when the call is direct. The check will fail if the access is through static SQL, DBMS_SQL, or dynamic SQL. ---- ==== Quellen ==== * Oracle Doku => https://docs.oracle.com/en/database/oracle/oracle-database/12.2/lnpls/ACCESSIBLE-BY-clause.html#GUID-9720619C-9862-4123-96E7-3E85F240FF36