background image
<< Dropping Procedures and Functions | Guidelines for Packages >>
<< Dropping Procedures and Functions | Guidelines for Packages >>

Creating and Using Packages

Creating and Using Packages
Developing and Using Stored Procedures 4-9
3.
In the Confirmation dialog box, click OK.
You dropped the
ADD_EVALUATION
procedure from the database.
Creating and Using Packages
In the preceding section, you created and tested procedures and functions that were
schema objects. This approach can be useful for testing subsets or small features of
your application.
Enterprise level applications have much greater complexity: some of the interfaces and
types are directly available to user, while others are used only by ohter functions and
procedures and are never called by the user. PL/SQL enables you to formally state the
relationship between these subprograms by placing them in the same package, which
is a schema object that groups and name-qualifies logically related elements such as
PL/SQL types, variables, functions and procedures. Encapsulating these elements
inside a package also prevents, over the life time of the applications, unintended
consequences such as name capture that is discussed in
"Overview of Stored
Procedures"
on page 4-1.
Procedures and functions that are defined within a package are known as packaged
subprograms
. Procedures and functions that are nested within other subprograms or
within a PL/SQL block are called local subprograms; they exist only inside the
enclosing block and cannot be referenced externally.
Another reason that standalone procedures and functions, like the ones in
"Creating
and Using Standalone Procedures and Functions"
on page 4-2, are limited to
large-scale development is that they can only send and receive scalar parameters
(
NUMBER
,
VARCHAR2,
and
DATE
), but cannot use a composite structure,
RECORD
,
unless it is defined in a package specification.
Packages usually have two parts: a specification and a body.
The package is defined by the package specification, which declares the types,
variables, constants, exceptions, cursors, functions and procedures that can be
See Also:
Oracle Database SQL Language Reference for information on the
DROP PROCEDURE
statement
Oracle Database SQL Language Reference for information on the
DROP FUNCTION
statement