8i | 9i | 10g | 11g | 12c | 13c | 18c | 19c | 21c | 23ai | Misc | PL/SQL | SQL | RAC | WebLogic | Linux
PL/SQL New Features and Enhancements in Oracle Database 12c Release 1 (12.1)
Oracle 12c includes a number of PL/SQL new features and enhancements, many of which have been covered in separate articles on this site. This article serves as a link to all of those, as well as introducing some of the more minor features listed in the Changes in Oracle Database 12c Release 1 section of the PL/SQL Language Reference manual.
Topics covered in this article:
- Invoker Rights Functions Can Be Result-Cached
- Libraries Defined Using Directory Objects and Credentials
- New Predefined Inquiry Directives ($$PLSQL_UNIT_OWNER, $$PLSQL_UNIT_TYPE)
- PLSQL_DEBUG Compilation Parameter is Deprecated
- PL/SQL Packages and Types Reference
Topics covered in separate articles on this site:
- Code Based Access Control (CBAC) : Granting Roles to PL/SQL Program Units in Oracle Database 12 Release 1 (12.1)
- Control Invoker Rights Privileges for PL/SQL Code in Oracle Database 12c Release 1 (12.1) (INHERIT [ANY] PRIVILEGES)
- Control Invoker Rights Privileges in Views in Oracle Database 12c Release 1 (12.1) (BEQUEATH CURRENT_USER)
- Edition-Based Redefinition Enhancements in Oracle Database 12c Release 1 (12.1)
- Extended Data Types in Oracle Database 12c Release 1 (12.1)
- Implicit Statement Results in Oracle Database 12c Release 1 (12.1) (DBMS_SQL.RETURN_RESULT and DBMS_SQL.GET_NEXT_RESULT)
- Invisible Columns in Oracle Database 12c Release 1 (12.1)
- Multitenant : Database Triggers on Pluggable Databases (PDBs) in Oracle 12c Release 1 (12.1)
- WITH Clause Enhancements in Oracle Database 12c Release 1 (12.1)
- PL/SQL-to-SQL Interface Enhancements for PL/SQL-Only Data Types in Oracle Database 12c Release 1 (12.1)
- PL/SQL White Lists Using the ACCESSIBLE BY Clause in Oracle Database 12c Release 1 (12.1)
- Using the TABLE Operator with Locally Defined Types in PL/SQL
- UTL_CALL_STACK : Get Detailed Information About the Currently Running Subprogram in Oracle Database 12c Release 1 (12.1)
Invoker Rights Functions Can Be Result-Cached
The PL/SQL Function Result Cache was introduced in Oracle 11g Release 1. One of the restrictions on its use was that invoker rights functions could not be cached. This restriction has been removed in Oracle Database 12c Release 1.
Libraries Defined Using Directory Objects and Credentials
In previous versions of the database, libraries were defined with an explicit path and were run by extproc
as the Oracle software owner.
In Oracle 12c, the CREATE LIBRARY statement has been enhanced to allow libraries to be optionally defined using directory objects and credentials (DBMS_CREDENTIAL).
-- Pre-12c : Still valid in 12c. CREATE OR REPLACE LIBRARY my_lib IS '/path/to/my_lib.so'; / -- 12c : Using Directory to specify path to object. CREATE OR REPLACE DIRECTORY my_dir AS '/path/to/"; CREATE LIBRARY my_lib AS 'my_lib.so' IN my_dir; / --12c : Using credential. BEGIN DBMS_CREDENTIAL.create_credential( credential_name => 'my_cred', username => 'me', password => 'my_password'); END; / CREATE OR REPLACE LIBRARY my_lib IS '/path/to/my_lib.so' CREDENTIAL my_cred; /
New Predefined Inquiry Directives ($$PLSQL_UNIT_OWNER, $$PLSQL_UNIT_TYPE)
Oracle introduced Conditional Compilation in Oracle 10g. Oracle database 12c includes two new Predefined Inquiry Directives called $$PLSQL_UNIT_OWNER
and $$PLSQL_UNIT_TYPE
, so the list now includes the following.
$$PLSQL_LINE
: The line number of the source code where this directive is located.$$PLSQL_UNIT
: The name of the current PL/SQL program unit.$$PLSQL_UNIT_OWNER
: The owner of the current PL/SQL program unit.$$PLSQL_UNIT_TYPE
: The type (procedure, function, package etc.) of the current PL/SQL program unit.$$plsql_compilation_parameter
: One of the PL/SQL compilation parameters (PLSCOPE_SETTINGS
,PLSQL_CCFLAGS
,PLSQL_CODE_TYPE
,PLSQL_OPTIMIZE_LEVEL
,PLSQL_WARNINGS
,NLS_LENGTH_SEMANTICS
,PERMIT_92_WRAP_FORMAT
).
PLSQL_DEBUG Compilation Parameter is Deprecated
The compilation parameter PLSQL_DEBUG
is now deprecated. Using PLSQL_OPTIMIZE_LEVEL=1
now includes compilation of PL/SQL for debugging. This change in functionality of the PLSQL_OPTIMIZE_LEVEL is not listed in parameter documentation itself, but it is mentioned in the PL/SQL Compilation Parameters list.
PL/SQL Packages and Types Reference
Although not directly listed as PL/SQL new features, the PL/SQL Packages and Types Reference manual is always filled with lots of changes for each database release. It is worth spending some time looking at the changes that have been introduced with the new release.
For more information see:
- Changes in Oracle Database 12c Release 1 (12.1) : PL/SQL Language Reference
- Oracle Database PL/SQL Packages and Types Reference 12c Release 1 (12.1)
Hope this helps. Regards Tim...