Creating Packages v11
A package is not an executable piece of code; rather it is a repository of code. When you use a package, you actually execute or make reference to an element within a package.
Creating the Package Specification
The package specification contains the definition of all the elements in the package that can be referenced from outside of the package. These are called the public elements of the package, and they act as the package interface. The following code sample is a package specification:
This code sample creates the emp_admin
package specification. This package specification consists of two functions and two stored procedures. We can also add the OR REPLACE
clause to the CREATE PACKAGE
statement for convenience.
Creating the Package Body
The body of the package contains the actual implementation behind the package specification. For the above emp_admin
package specification, we shall now create a package body which will implement the specifications. The body will contain the implementation of the functions and stored procedures in the specification.