Name

CREATE PACKAGE

Synopsis

CREATE [OR REPLACE] PACKAGE
[schema.]package_name
{IS | AS}
pl/sql_package_spec

Creates the specification for a stored package ( package_name).

Keywords

OR REPLACE

Specifies that if the package exists, it is to be replaced.

pl/sql_package_spec

The package specification, written in PL/SQL. You must specify the IS or AS keyword.

Notes

This command creates only the package specification. You must use the CREATE PACKAGE BODY command to create the package body. You must have the CREATE PROCEDURE or CREATE ANY PROCEDURE privilege to issue this command.

Example

The following example creates the package specification for my_pkg:

CREATE PACKAGE my_pkg AS
     FUNCTION getbal (sale_amt NUMBER, acct VARCHAR2)
          RETURN NUMBER;
     PROCEDURE drop_acct (acct VARCHAR2);
     PROCEDURE add_credit (add_amt NUMBER, acct VARCHAR2);
END my_pkg;

Get Oracle Database Administration: The Essential Refe now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.