Purpose of Packages
There are a number of reasons why a package might be used rather than using separate individual subprograms.
Packages organize groups of related subprograms into logical groupings. As you design an application, packages provide a collective entity that provides a clear interface to the underlying PL/SQL code.
Packages provide a separate namespace for subprograms with the same identifier. For instance, you might have two "FORMAT_NAME" functions. One could be associated with a PERSON package
that returns the last name concatenated to the first name, and a separate FORMAT_NAME function in a COMPANY package that capitalizes the name of the company and removes any trailing designation
such as Inc., LLC, etc.
When Oracle loads an object from a package into memory, other contiguous objects in that package might also be loaded into memory. Performance might be better, and some objects might be shared among subprograms. These advantages are generally secondary
to the intent to define well organized logical groupings of PL/SQL functionality.
In versions 7.4 and earlier Oracle attempted to load the entire package in memory. Now Oracle loads package objects on an on-demand basis, in 4k chunks or smaller.
Wrapping is the process of hiding PL/SQL code in order to protect source code from being viewed by unauthorized resources. Since a discussion of this utility is outside the scope of this course, see the Oracle documentation for details of this process.
If you are using this feature to wrap packages, the package body (PL/SQL implementation) can be obscured while leaving the package specification visible to the outside world.