Creating packages v16
A package isn't an executable piece of code but a repository of code. When you use a package, you 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 you can reference 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. You 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 emp_admin
package specification in the example, this code now create a package body that implements the specifications. The body contains the implementation of the functions and stored procedures in the specification.