Oracle Inquiry Directives and Compilation Parameters
Version 18.3

General Information
Library Note Morgan's Library Page Header
For how many years have you been working with physical servers that are starving your database of the memory necessary to deploy important new performance features such as the Result Cache, Memoptimize Pool, In-Memory Aggregation, In-Memory Column Store, and Full Database Caching? Too long? Contact me to learn how to improve all queries ... not just some queries.
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;
/
 
Compilation Parameters
Demo 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
Built-in Functions
Built-in Packages
DBMS_APPLICATION_INFO
DBMS_DB_VERSION
Pipelined Table Functions
PL/SCOPE
Procedures
Table Triggers
Types
What's New In 18c
What's New In 19c

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-2019 Daniel A. Morgan All Rights Reserved
DBSecWorx