CREATE PACKAGE statement (PL/SQL)
The CREATE PACKAGE statement creates a package specification, which defines the interface to a package.
Syntax
Description
- package-name
- Specifies an identifier for the package.
- declaration
- Specifies an identifier for a public item. The public item can
be accessed from outside of the package using the syntax
package-name.item-name
. There can be zero or more public items. Public item declarations must come before procedure or function declarations. The declaration can be any of the following:- Collection declaration
- EXCEPTION declaration
- Record declaration
- REF CURSOR and cursor variable declaration
- TYPE definition for a collection, record, or REF CURSOR type variable
- SUBTYPE definition
- Variable declaration
- procedure-name
- Specifies an identifier for a public procedure. The public procedure
can be invoked from outside of the package using the syntax
package-name.procedure-name()
. - procedure-parameter
- Specifies an identifier for a formal parameter of the procedure.
- function-name
- Specifies an identifier for a public function. The public function
can be invoked from outside of the package using the syntax
package-name.function-name()
. - function-parameter
- Specifies an identifier for a formal parameter of the function. Input (IN mode) parameters can be initialized with a default value.
- return-type
- Specifies a data type for the value that is returned by the function.
Notes
The CREATE PACKAGE statement can be submitted in obfuscated form. In an obfuscated statement, only the package name is readable. The rest of the statement is encoded in such a way that it is not readable, but can be decoded by the database server. Obfuscated statements can be produced by calling the DBMS_DDL.WRAP function.