plsql Package Usage


Example

Packages in PLSQL are a collection of procedures, functions, variables, exceptions, constants, and data structures. Generally the resources in a package are related to each other and accomplish similar tasks.

Why Use Packages

  • Modularity
  • Better Performance/ Funtionality

Parts of a Package

Specification - Sometimes called a package header. Contains variable and type declarations and the signatures of the functions and procedures that are in the package which are public to be called from outside the package.

Package Body - Contains the code and private declarations.

The package specification must be compiled before the package body, otherwise the package body compilation will report an error.