Managing Subprograms |
Subprograms do not have to belong to a package. Program units that are created outside of a package are called stored or standalone subprograms. Stored subprograms can be either functions or procedures. These subprograms are stored in the database and can be reused by multiple applications. Both procedures and functions can accept parameters when they are executed (called). To execute a stored subprogram, you only need to include its object name.
A PL/SQL procedure is a subprogram that performs a specific action. You specify the name of the procedure, its parameters, its local variables, and the BEGIN-END block that contains its code and handles any exceptions. A function is a subprogram that computes a value. Functions and procedures are structured alike, except that functions return a value. For information on subprograms in PL/SQL blocks, see Using Local PL/SQL Subprograms in PL/SQL Blocks.