SQL$HELP_OLD72.HLB  —  DROP  MODULE  Examples
    Example 1: Removing a module from an Oracle Rdb database

    SQL> DROP MODULE employee_salary;

    Example 2: Observing the DROP MODULE ... CASCASE action

    This example demonstrates that dependencies may exists between
    the module being dropped and other database objects such as
    routines and triggers. The script uses SET FLAGS with the WARN_
    INVALID option so that the database administrator is informed
    of any affected objects. In this case a rollback is used to
    undo the DROP MODULE ... CASCADE as the affects might damage
    the application environment.

    SQL> start transaction read write;
    SQL>
    SQL> create module FIRST_MODULE
    cont>     function GET_TIME ()
    cont>     returns TIME (2);
    cont>     return CURRENT_TIME (2);
    cont> end module;
    SQL>
    SQL> create module SECOND_MODULE
    cont>     procedure PRINT_TRACE (in :arg varchar(40));
    cont>     begin
    cont>     trace GET_TIME(), ': ', :arg;
    cont>     end;
    cont> end module;
    SQL>
    SQL> create table SAMPLE_TABLE
    cont>     (ident integer,
    cont>      descr char(100));
    SQL> create trigger SAMPLE_TABLE_TRIGGER
    cont>     after insert on SAMPLE_TABLE
    cont>     (trace GET_TIME(), ': ', SAMPLE_TABLE.descr)
    cont>     for each row;
    SQL>
    SQL> commit;
    SQL>
    SQL> set flags 'warn_invalid';
    SQL> drop module FIRST_MODULE restrict;
    %RDB-E-NO_META_UPDATE, metadata update failed
    -RDMS-E-OBJ_INUSE, object "GET_TIME" is referenced by SAMPLE_TABLE_TRIGGER. (usage: Trigger)
    -RDMS-E-MODNOTDEL, module "FIRST_MODULE" has not been deleted
    SQL> drop module FIRST_MODULE cascade;
    ~Xw: Trigger "SAMPLE_TABLE_TRIGGER" marked invalid
    ~Xw: Routine "PRINT_TRACE" marked invalid
    SQL>
    SQL> rollback;
Close Help