Oracle Predefined Inqiury Directives
Version 12.1.0.1

General Information
Library Note This page has been updated for Oracle release 12cR1 and shown to be compatible in the Container DB.
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 routes.
 
Syntax
$$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 (new 12.1) 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 (new 12.1) 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
Compilation Parameters (new 12.1) CREATE OR REPLACE PROCEDURE test AUTHID DEFINER IS
BEGIN
  dbms_output.put_line('$$PLSCOPE_SETTINGS = ' || $$PLSCOPE_SETTINGS);
  dbms_output.put_line('$$PLSQL_CCFLAGS = ' || $$PLSQL_CCFLAGS);
  dbms_output.put_line('$$PLSQL_CODE_TYPE = ' || $$PLSQL_CODE_TYPE);
  dbms_output.put_line('$$PLSQL_OPTIMIZE_LEVEL = ' || $$PLSQL_OPTIMIZE_LEVEL);
  dbms_output.put_line('$$PLSQL_WARNINGS = ' || $$PLSQL_WARNINGS);
  dbms_output.put_line('$$NLS_LENGTH_SEMANTICS = ' || $$NLS_LENGTH_SEMANTICS);
END test;
/

set serveroutput on

exec test

Related Topics
DBMS_APPLICATION_INFO
DBMS_DB_VERSION
Functions
Packages
Pipelined Table Functions
Procedures
Table Triggers
Types

Morgan's Library Page Footer
This site is maintained by Dan Morgan. Last Updated: This site is protected by copyright and trademark laws under U.S. and International law. © 1998-2014 Daniel A. Morgan All Rights Reserved