What are the benefits of using a package? Describe two parts of a package and their contents.
What will be an ideal response?
The objects in a package can be declared as public objects, which can be referenced from
outside, or private objects, which are known only to the package. You can restrict access
to a package to its specification only and hide the actual programming aspect of it. A
package follows some rules of object-oriented programming, and it gives programmers
some object-oriented capabilities. A package compiles successfully even without a body,
if the specification compiles. When an object in the package is referenced for the first
time, the entire package is loaded into memory. All package elements are available from
that point on because the entire package stays in memory. This one-time loading
improves performance. It is very useful when functions and procedures in it are accessed
frequently. The package also follows top-down design.
A package provides an extra layer to a module. A module has a header and a body,
whereas a package has specification and a body. A module’s header specifies the name
and the parameters, which tell us how to call that module. Similarly, the package
specification tells us how to call different modules within a package.
A package specification does not contain any code, but it contains information about
elements of the package. It contains definitions of functions and procedures, declarations
of global or public variables, and anything else that can be declared in a PL/SQL block’s
declaration section. The objects in the specification section of a package are called public
objects.
A package body contains actual programming code for the modules described in the
specification section. It also contains code for the modules not described in the
specification section. The module code in the body without its description in the
specification is called a private or hidden module, and it is not visible outside the body of
the package.
You might also like to view...
Match each of the slide layouts terms to their meanings:
I. Title Slide II. Two Content III. Blank IV. Picture with Caption V. Title and Content A. Contains no placeholders B. Contains placeholders for a title and content C. Contains placeholders for a title and subtitle D. Contains placeholders for an image and text E. Often used to put text on one side of a slide and graphic content on the other side
___________ makes use of elliptic curves in which the variables and coefficients are all restricted to elements of a finite field.
A. Prime curve B. Elliptic curve cryptography(ECC) C. abelian group D. Micali-Schnorr