SQL$HELP_OLD72.HLB  —  DROP  SCHEMA  Examples
    Example 1: Deleting a schema with implicit RESTRICT

    In the following example, the user must delete the definitions
    that refer to the schema RECRUITING before deleting the schema
    itself.

    After setting the default schema to RECRUITING and the default
    catalog to ADMINISTRATION, the user can qualify each definition
    name with only the alias CORP.

    SQL> ATTACH 'ALIAS CORP FILENAME CORPORATE_DATA';
    SQL> SET CATALOG '"CORP.ADMINISTRATION"';
    SQL> SET SCHEMA '"CORP.ADMINISTRATION".RECRUITING';
    SQL> SET QUOTING RULES 'SQL92';
    SQL> DROP SCHEMA "CORP.RECRUITING";
    %RDB-E-NO_META_UPDATE, metadata update failed
    -RDMS-E-SCHEMAINUSE, schema RECRUITING currently in use
    SQL> DROP TABLE "CORP.CANDIDATES";
    SQL> DROP TABLE "CORP.COLLEGES";
    %RDB-E-NO_META_UPDATE, metadata update failed
    -RDMS-F-CONEXI, relation COLLEGES is referenced in constraint DEGREES_FOREIGN3
    -RDMS-F-RELNOTDEL, relation COLLEGES has not been deleted
    SQL> DROP TABLE "CORP.DEGREES";
    %RDB-E-NO_META_UPDATE, metadata update failed
    -RDMS-F-TRGEXI, relation DEGREES is referenced in trigger
    EMPLOYEE_ID_CASCADE_DELETE
    SQL> DROP TABLE "CORP.RESUMES";
    %RDB-E-NO_META_UPDATE, metadata update failed
    -RDMS-F-TRGEXI, relation RESUMES is referenced in trigger
    EMPLOYEE_ID_CASCADE_DELETE
    -RDMS-F-RELNOTDEL, relation RESUMES has not been deleted
    SQL> --
    SQL> -- The trigger is part of another schema, PERSONNEL. Since this
    SQL> -- is not the default schema, the user qualifies the trigger name
    SQL> -- with schema and names.
    SQL> --
    SQL> DROP TRIGGER "CORP.ADMINSTRATION".PERSONNEL.EMPLOYEE_ID_CASCADE_DELETE;
    SQL> DROP CONSTRAINT "CORP.DEGREES_FOREIGN3";
    %RDB-E-NO_META_UPDATE, metadata update failed
    -RDMS-F-CONDELVIAREL, constraint DEGREES_FOREIGN3 can only be deleted by
    changing or deleting relation DEGREES
    SQL> DROP TABLE "CORP.DEGREES";
    SQL> DROP TABLE "CORP.RESUMES";
    SQL> DROP TABLE "CORP.COLLEGES";
    SQL> DROP SCHEMA "CORP.RECRUITING";

    Example 2: Deleting a schema with CASCADE

    In the following example, SQL deletes the definitions that refer
    to the schema ACCOUNTING, then deletes the schema itself:

    SQL> DROP SCHEMA "CORP.ACCOUNTING" CASCADE;
    Domain "CORP.ADMINISTRATION".ACCOUNTING.BUDGET is also being dropped.
    Domain "CORP.ADMINISTRATION".ACCOUNTING.CODE is also being dropped.
    SQL>
Close Help