Oracle Inquiry Directives and Compilation Parameters
Version 21c
General Information
Library Note
Morgan's Library Page Header
Which has the higher priority in your organization: Deploying a new database or securing the ones you already have?
Looking for a website, and resources, dedicated solely to securing Oracle databases? Check out DBSecWorx.
Purpose
Predefined Inquiry Directives act like built-in functions, but are not objects such as can be found in DBA_OBJECTS that return values related to compiled PL/SQL objects.
The Inquiry Directives are of great value in creating robust debugging and error handling routines.
Some of the code samples on this page relate to PL/SCOPE ... click on the link at the bottom of this page to view additional information and code examples with PL/SCOPE.
Predefined Inquiry Directives
$$PLSQL_LINE
set serveroutput on
BEGIN
NULL;
NULL;
NULL;
dbms_output.put_line($$plsql_line);
END;
/
$$PLSQL_UNIT
CREATE OR REPLACE PROCEDURE test AUTHID DEFINER IS
BEGIN
dbms_output.put_line('I am ' || $$plsql_unit);
END test;
/
set serveroutput on
exec test
$$PLSQL_UNIT_OWNER
CREATE OR REPLACE PROCEDURE test AUTHID DEFINER IS
BEGIN
dbms_output.put_line('I am owned by ' || $$plsql_unit_owner);
END test;
/
set serveroutput on
exec test
$$PLSQL_UNIT_TYPE
CREATE OR REPLACE PROCEDURE test AUTHID DEFINER IS
BEGIN
dbms_output.put_line('I am a ' || $$plsql_unit_type);
END test;
/
set serveroutput on
exec test
Assigning Values to Inquiry Directives
Demo
ALTER SESSION SET PLSQL_CCFlags = 'UW_Flag:1, Some_Flag:2, PLSQL_CCFlags:42';
set serveroutput on
BEGIN
dbms_output.put_line($$UW_Flag);
dbms_output.put_line($$Some_Flag);
dbms_output.put_line($$PLSQL_CCFlags);
END;
/