Modules have multiple features that make them useful database
objects.
Module features allow you to:
- Extend schema support by allowing you to group together, in a
named set, a collection of related data type definitions, database
object definitions and other logic elements including:
- SQL procedures
- A module initialization procedure for implicit execution upon
module initialization
- User-defined data type definitions including: distinct type,
array type, associative array type, row type, and cursor type
- Define a namespace such that objects defined within the module
can refer to other objects defined in the module without providing
an explicit qualifier.
- Add object definitions that are private to the module. These
objects can only be referenced by other objects within the module.
- Add object definitions that are published. Published objects
can be referenced from within the module or from outside of the module.
- Define published prototypes of routines without routine-bodies
in modules and later implement the routine-bodies using the routine
prototype.
- Initialize the module by executing the module initialization procedure
for the module. This procedure can include SQL statements, SQL PL
statements, and can be used to set default values for global variables
or to open cursors.
- Reference objects defined in the module from within the module
and from outside of the module by using the module name as a qualifier
(2-part name support) or a combination of the module name and schema
name as qualifiers (3-part name support).
- Drop objects defined within the module.
- Drop the module.
- Manage who can reference objects in a module by allowing you to
grant and revoke the EXECUTE privilege for the module.