Creating modules is a task that you would perform when
you have identified a set of routines, data types, and variables that
support a common business need and you want to create them together
within a common namespace for easier management and deployment.
Before you begin
To
create a module you require:
- Privilege to execute the CREATE MODULE statement in a given schema.
About this task
Creating modules can be done at any time during database design or modification and can be done
from the Db2®
Command Line Processor.
Restrictions
For
restrictions on this task:
Procedure
- Formulate a CREATE MODULE statement:
- Specify a name for the module.
The name can
be qualified by a schema name to specify in what schema the module
should be created.
- Execute the CREATE MODULE statement.
Results
If
the CREATE MODULE statement executes successfully, the module is created
in the database.
Example
The
following is an example of how to create a module named inventory:
CREATE MODULE inventory@
What to do next
Once
the module is created, you can add data type definitions, cursor definitions,
variables, and routine definitions to it by executing the ALTER MODULE
statement.