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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.