1 Introduction to Oracle Supplied PL/SQL Packages & Types
Oracle supplies many PL/SQL packages with the Oracle server to extend database functionality and provide PL/SQL access to SQL features. You can use the supplied packages when creating your applications or for ideas in creating your own stored procedures.
This manual covers the packages provided with the Oracle database server. Packages supplied with other products, such as Oracle Developer or the Oracle Application Server, are not covered.
Note that not every package or type described in this manual or elsewhere in the Oracle Database Documentation Library is installed by default. In such cases, the documentation states this and explains how to install the object. Run this query as a suitably privileged user:
SELECT DISTINCT Owner, Object_Type, Object_Name FROM DBA_Objects_AE WHERE Owner IN ( 'SYS', 'OUTLN', 'SYSTEM', 'CTXSYS', 'DBSNMP', 'LOGSTDBY_ADMINISTRATOR', 'ORDSYS', 'ORDPLUGINS', 'OEM_MONITOR', 'MDSYS', 'LBACSYS', 'DMSYS', 'WMSYS', 'OLAPDBA', 'OLAPSVR', 'OLAP_USER', 'OLAPSYS', 'EXFSYS', 'SYSMAN', 'MDDATA', 'SI_INFORMTN_SCHEMA', 'XDB', 'ODM') AND Object_Type IN ('PACKAGE', 'TYPE') ORDER BY Owner, Object_Type, Object_Name
This lists every Oracle-supplied package and type that is currently installed in the database. Note that it lists a number of objects not mentioned in the Oracle Database Documentation Library. This is deliberate. Some of the Oracle-supplied packages and types are intended to be used only by other Oracle-supplied components. Any package or type that is not described in the Oracle Database Documentation Library is not supported for direct customer use.
This chapter contains the following topics:
-
Summary of Oracle Supplied PL/SQL Packages and Types
See Also:
Oracle Database Development Guide for information on how to create your own packages
1.1 Package Overview
A package is an encapsulated collection of related program objects stored together in the database. Program objects are procedures, functions, variables, constants, cursors, and exceptions.
1.1.1 Package Components
PL/SQL packages have two parts: the specification and the body, although sometimes the body is unnecessary. The specification is the interface to your application; it declares the types, variables, constants, exceptions, cursors, and subprograms available for use. The body fully defines cursors and subprograms, and so implements the specification.
Unlike subprograms, packages cannot be called, parameterized, or nested. However, the formats of a package and a subprogram are similar:
CREATE PACKAGE name AS -- specification (visible part) -- public type and item declarations -- subprogram specifications END [name]; CREATE PACKAGE BODY name AS -- body (hidden part) -- private type and item declarations -- subprogram bodies [BEGIN -- initialization statements] END [name];
The specification holds public declarations that are visible to your application. The body holds implementation details and private declarations that are hidden from your application. You can debug, enhance, or replace a package body without changing the specification. You can change a package body without recompiling calling programs because the implementation details in the body are hidden from your application.
1.1.2 Using Oracle Supplied Packages
Most Oracle supplied packages are automatically installed when the database is created. Certain packages are not installed automatically. Special installation instructions for these packages are documented in the individual chapters.
To call a PL/SQL function from SQL, you must either own the function or have EXECUTE
privileges on the function. To select from a view defined with a PL/SQL function, you must have SELECT
privileges on the view. No separate EXECUTE
privileges are needed to select from the view. Instructions on special requirements for packages are documented in the individual chapters.
1.1.3 Creating New Packages
To create packages and store them permanently in an Oracle database, use the CREATE
PACKAGE
and CREATE
PACKAGE
BODY
statements. You can execute these statements interactively from SQL*Plus or Enterprise Manager.
To create a new package, do the following:
-
Create the package specification with the
CREATE
PACKAGE
statement.You can declare program objects in the package specification. Such objects are called public objects. Public objects can be referenced outside the package, as well as by other objects in the package.
-
Create the package body with the
CREATE
PACKAGE
BODY
statement.You can declare and define program objects in the package body.
-
You must define public objects declared in the package specification.
-
You can declare and define additional package objects, called private objects. Private objects are declared in the package body rather than in the package specification, so they can be referenced only by other objects in the package. They cannot be referenced outside the package.
See Also:
-
Oracle Database Development Guide for more information on creating new packages
for more information on storing and executing packages
-
1.1.3.1 Separating the Specification and Body
The specification of a package declares the public types, variables, constants, and subprograms that are visible outside the immediate scope of the package. The body of a package defines the objects declared in the specification, as well as private objects that are not visible to applications outside the package.
Oracle stores the specification and body of a package separately in the database. Other schema objects that call or reference public program objects depend only on the package specification, not on the package body. Using this distinction, you can change the definition of a program object in the package body without causing Oracle to invalidate other schema objects that call or reference the program object. Oracle invalidates dependent schema objects only if you change the declaration of the program object in the package specification.
1.1.3.1.1 Creating a New Package: Example
The following example shows a package specification for a package named EMPLOYEE_MANAGEMENT
. The package contains one stored function and two stored procedures.
CREATE PACKAGE employee_management AS FUNCTION hire_emp (name VARCHAR2, job VARCHAR2, mgr NUMBER, hiredate DATE, sal NUMBER, comm NUMBER, deptno NUMBER) RETURN NUMBER; PROCEDURE fire_emp (emp_id NUMBER); PROCEDURE sal_raise (emp_id NUMBER, sal_incr NUMBER); END employee_management;
The body for this package defines the function and the procedures:
CREATE PACKAGE BODY employee_management AS FUNCTION hire_emp (name VARCHAR2, job VARCHAR2, mgr NUMBER, hiredate DATE, sal NUMBER, comm NUMBER, deptno NUMBER) RETURN NUMBER IS
The function accepts all arguments for the fields in the employee table except for the employee number. A value for this field is supplied by a sequence. The function returns the sequence number generated by the call to this function.
new_empno NUMBER(10); BEGIN SELECT emp_sequence.NEXTVAL INTO new_empno FROM dual; INSERT INTO emp VALUES (new_empno, name, job, mgr, hiredate, sal, comm, deptno); RETURN (new_empno); END hire_emp; PROCEDURE fire_emp(emp_id IN NUMBER) AS
The procedure deletes the employee with an employee number that corresponds to the argument emp_id
. If no employee is found, then an exception is raised.
BEGIN DELETE FROM emp WHERE empno = emp_id; IF SQL%NOTFOUND THEN raise_application_error(-20011, 'Invalid Employee Number: ' || TO_CHAR(emp_id)); END IF; END fire_emp; PROCEDURE sal_raise (emp_id IN NUMBER, sal_incr IN NUMBER) AS
The procedure accepts two arguments. Emp_id
is a number that corresponds to an employee number. Sal_incr
is the amount by which to increase the employee's salary.
BEGIN -- If employee exists, then update salary with increase. UPDATE emp SET sal = sal + sal_incr WHERE empno = emp_id; IF SQL%NOTFOUND THEN raise_application_error(-20011, 'Invalid Employee Number: ' || TO_CHAR(emp_id)); END IF; END sal_raise; END employee_management;
1.2 Summary of Oracle Supplied PL/SQL Packages and Types
PL/SQL packages are supplied with the Oracle server that extend database functionality and provide PL/SQL access to SQL features.
These packages, listed in the following table, run as the invoking user, rather than the package owner. Unless otherwise noted, the packages are callable through public synonyms of the same name.
Note:
-
The procedures and functions provided in these packages and their external interfaces are reserved by Oracle and are subject to change.
-
Modifying Oracle supplied packages can cause internal errors and database security violations. Do not modify supplied packages.
Table 1-1 Summary of Oracle Supplied PL/SQL Packages
Package Name | Description |
---|---|
|
For a complete description of all the packages that ship with Oracle Application Express, see Oracle Application Express API Reference |
|
Lets you administer servers and the data dictionary |
|
The |
|
Lets you generate |
|
Lets you create and manage the preferences, section lists and stopgroups required for Text indexes |
|
Lets you request document services |
|
The |
|
Lets you manage the index log |
|
Lets you generate query feedback, count hits, and create stored query expressions |
|
Lets you create various index reports |
|
Lets you to manage and browse thesauri |
|
For use with the user-lexer |
|
Facilitates the use of Advisor functionality regarding the Automatic Database Diagnostic Monitor |
|
Contains interfaces for advanced query rewrite users to create, drop, and maintain functional equivalence declarations for query rewrite |
|
Part of the SQLAccess Advisor, an expert system that identifies and helps resolve performance problems relating to the execution of SQL statements |
|
Provides support for the asynchronous notification of database events |
|
The |
|
Lets you register an application name with the database for auditing or performance tracking purposes |
|
Provides administrative procedures to start, stop, and configure an apply process |
|
Lets you add a message (of a predefined object type) onto a queue or to dequeue a message |
|
Lets you perform administrative functions on a queue or queue table for messages of a predefined object type |
|
Provides procedures to manage the configuration of Advanced Queuing asynchronous notification by e-mail and HTTP |
|
Plays a part in providing secure access to the Oracle JMS interfaces |
|
Provides an interface to validate properties of the input value |
|
The |
|
The |
|
The |
|
The |
|
Used by the DBA as well as Enterprise Manager to access the |
|
Contains a subprogram that generates and stores optimizer statistics for cubes and dimensions |
|
Describes administrative procedures to start, stop, and configure a capture process; used in Replication |
|
Provides interfaces to compare and converge database objects at different databases |
|
Provides an interface to facilitate choosing the correct compression level for an application |
|
Provides an interface to manage the Database Resident Connection Pool |
|
Is part of a set of features that clients use to receive notifications when result sets of a query have changed. The package contains interfaces that can be used by mid-tier clients to register objects and specify delivery mechanisms. |
|
The |
|
Lets you encrypt and decrypt stored data, can be used in conjunction with PL/SQL programs running network communications, and supports encryption and hashing algorithms |
|
Provides an interface to customize the setup when transporting a tablespace containing binary XML data |
|
Contains subprograms that create OLAP cubes and dimensions, and that load and process the data for querying |
|
Contains subprograms for evaluating cube materialized views to support log-based fast refresh and query rewrite |
|
|
|
Implements the Oracle Data Mining interface for creating, evaluating, and managing mining models |
|
Provides subroutines that can be used to prepare data for Oracle Data Mining |
|
Lets you move all, or part of, a database between databases, including both data and metadata |
|
The |
|
The |
|
Provides an interface comprising a file system-like abstraction backed by one or more Store Providers |
|
Provides the Application Programming Interface (API) specification for |
|
Provides users the ability to use tape or Amazon S3 Web service as a storage tier when doing Information Lifecycle Management for their database tables |
|
Provides an interface to operate a SecureFile-based store (SFS) for the content interface described in the |
|
Provides access to some SQL DDL statements from stored procedures, and provides special administration operations not available as DDLs |
|
Implements server-side debuggers and provides a way to debug server-side PL/SQL program units |
|
The |
|
The |
|
Describes the arguments of a stored procedure with full name translation and security checking |
|
Allows applications to notify the primary database in an Oracle Data Guard broker environment to initiate a fast-start failover when the application encounters a condition that warrants a failover |
|
Enables you to verify dimension relationships and provides an alternative to the Enterprise Manager Dimension Wizard for displaying a dimension definition |
|
Maintains the Trusted Database List, which is used to determine if a privileged database link from a particular server can be accepted |
|
The |
|
The |
|
The |
|
Implements the embedded PL/SQL gateway that enables a Web browser to invoke a PL/SQL stored procedure through an HTTP listener |
|
Provides a procedure that enables you to create an error logging table so that DML operations can continue after encountering errors rather than abort and roll back |
|
Provides fine-grained security functions |
|
One of a set of Streams packages, provides administrative interfaces for managing file groups, file group versions, files and file group repositories |
|
Lets you copy a binary file within a database or to transfer a binary file between databases |
|
Lets you flash back to a version of the database at a specified wall-clock time or a specified system change number (SCN) |
|
Contains procedures for disassociation and re-association of a Flashback Data Archive (FDA) enabled table from/with its underlying FDA respectively. |
|
Enables frequent itemset counting |
|
The |
|
The |
|
The |
|
The |
|
The |
|
Contains functions and procedures for validating the data in tables used by analytic views and hierarchies and for creating a log table. |
|
Contains constants and procedure declarations for health check management |
|
Provides an interface for profiling the execution of PL/SQL applications |
|
Enables parallel processing for heterogeneous targets access |
|
Lets you use Heterogeneous Services to send pass-through SQL statements to non-Oracle systems |
|
The |
|
The |
|
The |
|
The |
|
Creates a table into which references to the chained rows for an Index Organized Table can be placed using the |
|
Provides a PL/SQL interface for accessing database functionality from Java |
|
Schedules and manages jobs in the job queue (Deprecated) |
|
Provides an interface for data-guide operations |
|
Provides functions and procedures to access data from LDAP servers |
|
Provides the Oracle Extension utility functions for LDAP |
|
Prepares the library cache on an Oracle instance by extracting SQL and PL/SQL from a remote instance and compiling this SQL locally without execution |
|
Provides general purpose routines for operations on Oracle Large Object ( |
|
Lets you request, convert and release locks through Oracle Lock Management services |
|
Provides functions to initialize and run the log reader |
|
Queries the dictionary tables of the current database, and creates a text based file containing their contents |
|
Describes procedures for configuring and managing the logical standby database environment |
|
You can use the procedures provided in the |
|
Lets callers easily retrieve complete database object definitions (metadata) from the dictionary |
|
Contains the interfaces for comparing two metadata documents in SXML format. The result of the comparison is an SXML difference document. This document can be converted to other formats using the |
|
Provides a set of utility subprograms |
|
Describes the Messaging Gateway administrative interface; used in Advanced Queuing |
|
Describes object types (used by the canonical message types to convert message bodies) and helper methods, constants, and subprograms for working with the Messaging Gateway message types; used in Advanced Queuing. |
|
Let you use PL/SQL for controlling additional tracing and statistics gathering |
|
Lets you refresh snapshots that are not part of the same refresh group and purge logs. |
|
The |
|
Provides the interface to administer the network Access Control List (ACL) |
|
The |
|
Returns the CPU cost of a user function based on the elapsed time of the function |
|
Provides the interface for procedures and functions associated with management of stored outlines Synonymous with |
|
Accumulates information in a buffer so that it can be retrieved later |
|
Enables the user to incrementally update table data in parallel |
|
The |
|
Provides intra-partition parallelism for creating partition-wise local indexes |
|
The |
|
In an application container with a pre-installed application, the |
|
The |
|
Provides a DBMS pipe service which enables messages to be sent between sessions |
|
The |
|
Provides subroutines that implement automatic data mining operations for predict, explain, and profile |
|
Provides an interface to print or retrieve the source text of a PL/SQL unit in its post-processed form |
|
The |
|
The |
|
Provides a Probe Profiler API to profile existing PL/SQL applications and identify performance bottlenecks |
|
Provides administrative procedures for configuring propagation from a source queue to a destination queue |
|
The |
|
Provides a built-in random number generator |
|
The |
|
Lets you perform an online reorganization of tables |
|
Lets you create groups of snapshots that can be refreshed together to a transactionally consistent point in time Requires the Distributed Option |
|
Provides data corruption repair procedures |
|
Provides an interface to operate on the Resource Configuration List, and to retrieve listener information for a resource |
|
Maintains plans, consumer groups, and plan directives; it also provides semantics so that you may group together changes to the plan schema |
|
Maintains privileges associated with resource consumer groups |
|
Provides an interface to operate on the Result Cache |
|
Lets you suspend large operations that run out of space or reach space limits after executing for a long time, fix the problem, and make the statement resume execution |
|
Provides row level security administrative interface |
|
The |
|
Provides procedures to create rowids and to interpret their contents |
|
Describes the subprograms that enable the evaluation of a rule set for a specified event. |
|
Provides the subprograms for creating and managing rules, rule sets, and rule evaluation contexts. |
|
Provides a collection of scheduling functions that are callable from any PL/SQL program |
|
Lets you issue alerts when some threshold has been violated |
|
Lets you create, delete, activate and deactivate services for a single instance |
|
Provides access to SQL |
|
Lets you keep objects in shared memory, so that they will not be aged out with the normal LRU mechanism |
|
Implements Simple Oracle Document Access ( |
|
Provides segment space information not available through standard SQL |
|
Provides tablespace and segment space administration not available through the standard SQL |
|
The |
|
Supports the SQL plan management feature by providing an interface for the DBA or other user to perform controlled manipulation of plan history and SQL plan baselines maintained for various SQL statements |
|
Lets you use dynamic SQL to access the database |
|
The |
|
The |
|
Provides an interface to the SQL Diagnosability functionality |
|
Provides an interface to implement the SQL Performance Analyzer. |
|
Provides the interface to tune SQL statements |
|
Provides statistical functions |
|
Provides a mechanism for users to view and modify optimizer statistics gathered for database objects |
|
Communicates with FMON to invoke mapping operations |
|
The |
|
Reports whether a database can be transported between platforms using the RMAN |
|
The |
|
The |
|
Provides routines to start and stop PL/SQL tracing |
|
Provides access to SQL transaction statements from stored procedures and monitors transaction activities |
|
Provides an interface to the message format transformation features of Oracle Advanced Queuing |
|
The |
|
The |
|
Checks if the transportable set is self-contained |
|
Consists of constants, which represent the built-in and user-defined types |
|
The |
|
Provides various utility routines |
|
Provides the interface to query, modify and delete current system or session settings |
|
Describes how to use the programming interface to Oracle Database Workspace Manager to work with long transactions |
|
Configures the Workload Capture system and produce the workload capture data. |
|
Provides an interface to replay and report on a record of a workload on a production or test system |
|
Lets you manage the Workload Repository, performing operations such as managing snapshots and baselines |
|
Contains the XA/Open interface for applications to call XA interface in PL/SQL |
|
Describes Resource Management and Access Control interface for PL/SQL |
|
Provides an interface to implement |
|
The |
|
The |
|
The |
|
Provides an interface to operate on the XDB resource's metadata and contents |
|
Describes the versioning interface |
|
Describes how an administrator can create a ConText index on the XML DB hierarchy and configure it for automatic maintenance |
|
Controls the Oracle XML DB repository security, which is based on Access Control Lists (ACLs) |
|
Provides event-related types and supporting subprograms |
|
Explains access to XMLType objects |
|
Converts the results of a SQL query to a canonical XML format |
|
Provides an interface to implement asychronous indexing and apply node referencing |
|
Explains access to the contents and structure of XML documents |
|
Provides database-to-XMLType functionality |
|
Provides XML-to-database-type functionality |
|
Explains procedures to register and delete XML schemas |
|
Provides the ability to store XML data in relational tables |
|
Provides an interface to perform translations so that strings can be searched or displayed in various languages |
|
Describes how to format the output of the |
|
Explains access to the contents and structure of XML documents |
|
Lets you debug external procedures on platforms with debuggers that attach to a running process |
|
Hypertext functions generate HTML tags |
|
Hypertext procedures generate HTML tags |
|
Provides an interface that enables the |
|
Provides an interface for sending and retrieving HTTP cookies from the client's browser |
|
Provides a Global PLSQL Agent Authorization callback function |
|
Provides an interface to access the coordinates where a user clicked on an image |
|
Contains subprograms that impose optimistic locking strategies so as to prevent lost updates |
|
Provides an interface to locate text patterns within strings and replace the matched string with another string |
|
Provides an interface for custom authentication |
|
Contains subprograms used by |
|
Contains utility subprograms for performing operations such as getting the value of CGI environment variables, printing the data that is returned to the client, and printing the results of a query in an HTML table |
|
Provides functions for coordinate system transformation |
|
Contains subprograms for various processing operations related to support for Catalog Services for the Web (CSW) |
|
Contains the Oracle Spatial geocoding subprograms, which let you geocode unformatted postal addresses |
|
Provides functions implementing geometric operations on spatial objects |
|
Contains functions and procedures for the Spatial GeoRaster feature, which lets you store, index, query, analyze, and deliver raster image data and its associated Spatial vector geometry data and metadata |
|
Contains subprograms for administrative operations related to GeoRaster. |
|
Contains utility functions and procedures for the Spatial GeoRaster feature, including those related to using triggers with GeoRaster data |
|
Provides functions for linear referencing system support |
|
Provides functions for migrating spatial data from previous releases |
|
Provides functions and procedures for working with data modeled as nodes and links in a network |
|
Contains functions and procedures for performing editing and analysis operations on network data using a network memory object |
|
Contains functions and procedures for performing editing and analysis operations on network data using a network memory object |
|
Contains subprograms to support the use of point clouds in Spatial |
|
Contains functions and procedures for spatial analysis and data mining |
|
Contains subprograms to support the use of triangulated irregular networks (TINs) in Spatial |
|
Provides procedures for creating and managing Spatial topologies |
|
Contains subprograms for editing Spatial topologies using a cache (TopoMap object) |
|
Provides functions for selecting parameters that determine the behavior of the spatial indexing scheme used in Oracle Spatial |
|
Provides utility functions and procedures for Oracle Spatial |
|
Contains subprograms for WFS support for registering and unregistering feature tables |
|
Provides utility functions and procedures for Oracle Spatial |
|
Contains subprograms for working with the Resource Description Framework (RDF) and Web Ontology Language (OWL) in an Oracle database. |
|
Contains subprograms for examining and enhancing the performance of the Resource Description Framework (RDF) and Web Ontology Language (OWL) support in an Oracle database |
|
Contains subprograms for managing extractor policies and semantic indexes created for documents |
|
Contains subprograms for providing fine-grained access control to RDF data, using either a virtual private database (VPD) or Oracle Label Security (OLS) |
|
Enables PL/SQL programs to use collection locators to query and update |
|
Provides a set of data compression utilities |
|
Provides database Web services |
|
Provides functions that encode RAW data into a standard encoded format so that the data can be transported between hosts |
|
Enables your PL/SQL programs to read and write operating system text files and provides a restricted version of standard operating system stream file I/O |
|
Enables HTTP callouts from PL/SQL and SQL to access data on the Internet or to call Oracle Web Server Cartridges |
|
Provides a set of services (Oracle Globalization Service) that help developers build multilingual applications |
|
Provides a procedure to support internet addressing |
|
Specifies which database or client PL/SQL is running |
|
Retrieves and formats error messages in different languages |
|
A utility for managing email which includes commonly used email features, such as attachments, CC, BCC, and return receipt |
|
Exposes a subset of the BLAS and LAPACK (Version 3.0) operations on vectors and matrices represented as |
|
Provides SQL functions for manipulating |
|
Recompiles invalid PL/SQL modules, invalid views, Java classes, indextypes and operators in a database, either sequentially or in parallels |
|
Enables a PL/SQL program to access an object by providing a reference to the object |
|
Provides PL/SQL functionality to send emails |
|
Provides subprograms to collect and analyze statistics for the Oracle Replication components in a distributed database environment |
|
Provides PL/SQL functionality to support simple TCP/IP-based communications between servers and the outside world |
|
Provides escape and unescape mechanisms for URL characters |
|
Provides an interface to download files, both BLOBs and BFILEs |
|
A self-describing data instance type containing an instance of the type plus a description |
|
Contains a description of a given type plus a set of data instances of that type |
|
Contains a type description of any persistent SQL type, named or unnamed, including object types and collection types; or, it can be used to construct new transient type descriptions |
|
Describes the types used in Advanced Queuing |
|
Describes public types defined to support the |
|
Contains URI Support, UriType Super Type, HttpUriType Subtype, DBUriType Subtype, XDBUriType Subtype, UriFactory Package |
|
Expression Filter feature is supplied with a set of predefined types and public synonyms for these types. |
|
Describes JMS types so that a PL/SQL application can use JMS queues of JMS types |
|
Describes LCR types, which are message payloads that contain information about changes to a database. |
|
Provides an extensible framework that supports current RFID tags with the standard family of EPC bit encodings for the supported encoding types |
|
Describes types defined in the DBMS_TF package to support PTF |
|
Describes the types used with rules, rule sets, and evaluation contexts |
|
Rules Manager is supplied with one predefined type and a public synonym |
|
Describes the SODA Types. |
|
Describes abstract streams types used with Oracle XML functionality |
|
Describes the types and functions used for native XML support in the server |