What is a PL/SQL Package?
A package is a schema object that groups logically related PL/SQL types, variables, and subprograms. Packages usually have two parts, a specification and a body; sometimes the body is unnecessary. The specification (spec for short) is the interface to the package. It declares the types, variables, constants, exceptions, cursors, and subprograms that can be referenced from outside the package. The body defines the queries for the cursors and the code for the subprograms. You can think of the spec as an interface and of the body as a “black box.” You can debug, enhance, or replace a package body without changing the package spec. To create package specs, use the SQL statement CREATE PACKAGE. If necessary, a CREATE PACKAGE BODY statement defines the package body. The spec holds public declarations, which are visible to stored procedures and other code outside the package. You must declare subprograms at the end of the spec after all other items (except pragmas that name a specific functio