|Oracle® Database SQL Language Reference
11g Release 2 (11.2)
|PDF · Mobi · ePub|
Package bodies are defined using PL/SQL. Therefore, this section provides some general information but refers to Oracle Database PL/SQL Language Reference for details of syntax and semantics.
BODY statement to create the body of a stored package, which is an encapsulated collection of related procedures, stored functions, and other program objects stored together in the database. The package body defines these objects. The package specification, defined in an earlier
PACKAGE statement, declares these objects.
Packages are an alternative to creating procedures and functions as standalone schema objects.
CREATE PACKAGE for a discussion of packages, including how to create packages
ALTER PACKAGE for information on modifying a package
DROP PACKAGE for information on removing a package from the database
To create or replace a package in your own schema, you must have the
PROCEDURE system privilege. To create or replace a package in another user's schema, you must have the
PROCEDURE system privilege. In both cases, the package body must be created in the same schema as the package.
To embed a
BODY statement inside an Oracle Database precompiler program, you must terminate the statement with the keyword
END-EXEC followed by the embedded SQL statement terminator for the specific language.
Package bodies are defined using PL/SQL. Therefore, the syntax diagram in this book shows only the SQL keywords. Please refer to Oracle Database PL/SQL Language Reference for the PL/SQL syntax, semantics, and examples.
plsql_source: See Oracle Database PL/SQL Language Reference.)
REPLACE to re-create the package body if it already exists. Use this clause to change the body of an existing package without dropping, re-creating, and regranting object privileges previously granted on it. If you change a package body, then Oracle Database recompiles it.
Users who had previously been granted privileges on a redefined package can still access the package without being regranted the privileges.
See Also:ALTER PACKAGE for information on recompiling package bodies
See Oracle Database PL/SQL Language Reference for the syntax and semantics of the