Dropping objects in a module

Dropping modules is a task that can be done when you no longer require the objects defined within the module. If only some of the objects in the module are no longer required you can optionally just drop those objects.

Before you begin

Before proceeding with this task:
  • The module must exist.
  • You must have the authority to execute the ALTER MODULE statement.

About this task

This task can be performed from any supported interface.


Restrictions

For restrictions:

Procedure

  1. To drop one or more objects from a module, formulate an ALTER MODULE statement:
    1. Specify the name of the module to be dropped.
    2. Specify the DROP clause.
    3. Specify the name of the module object to be dropped. If the module object is a routine, specify the signature of the routine.
  2. To drop all objects in a module, formulate an ALTER MODULE statement:
    1. Specify the name of the module.
    2. Specify the DROP BODY clause.
  3. Execute the ALTER MODULE statement.

Results

If the statement executes successfully, the specified module objects will be dropped from the module.

Example

Consider a module defined as:
CREATE MODULE m @  

ALTER MODULE m PUBLISH PROCEDURE B() @  

ALTER MODULE m PUBLISH PROCEDURE A() 
                         BEGIN 
                           CALL B();         
                         END @  

ALTER MODULE m ADD PROCEDURE B() BEGIN  END @ 
The procedure B can be dropped by executing the following statement:
ALTER MODULE m DROP PROCEDURE B @
When the statement executes successfully, the procedure B is dropped from module m. The dependent object procedure A is marked as inoperative, because procedure B which it references is no longer available.

All of the private objects defined in a module named m can be dropped by executing:

ALTER MODULE m DROP BODY @
When the statement executes successfully:
  • The bodies of published procedures defined in the module will be dropped. The procedure prototypes remain defined.
  • The data types and global variables that are private to the module are dropped. The published data types and global variables remain defined.
  • The module is not dropped. It remains defined within the schema.

What to do next

Once you have successfully dropped objects from a module, you might want to create module objects, alter the module, or other module related tasks.