RDOHELP72.HLB  —  DELETE_RELATION
    Deletes one or more relation definitions and all associated
    relation-specific constraints. When the DELETE RELATION statement
    executes, Oracle Rdb deletes the relation definition, the storage
    map (if one exists), the constraints associated with the relation
    definition, and the data stored in that relation from the
    physical database. If you invoke the database using the PATHNAME
    argument, Oracle Rdb also deletes the relation definition from the
    CDD$DATABASE definition of the database in the data dictionary.

    Example:

    DELETE RELATION COLLEGES.

1  –  Format

  (B)0DELETE RELATION qqqwqqqq> relation-name qqqqwqqqqq> .
                     mqqqqq<qqqqq , <qqqqqqqqqj

    relation-name      The name of the relation definition you want
                       to delete.

2  –  More

    You must have the Oracle Rdb DELETE privilege to a relation to
    delete the relation with the DELETE RELATION statement.

    If the database is created with the DICTIONARY IS REQUIRED
    option, you must invoke the database by path name, rather than
    file name, before you issue this statement.

    You cannot delete a relation when there are other active
    transactions involving the relation. That is, you must have
    EXCLUSIVE access to the relation.

    If a view definition refers to a relation you want to delete, you
    must delete that view definition before you delete the relation.

    If a constraint in the database references a relation, you
    cannot delete that relation until you delete the constraint that
    references the relation.

    You must execute this statement in a read/write transaction.
    If there is no active transaction and you issue this statement,
    Oracle Rdb starts a read/write transaction implicitly.

    Other users are allowed to be attached to the database when you
    issue the DELETE RELATION statement.

3  –  Examples

    Example 1

    Delete a single relation definition:

    RDO> INVOKE DATABASE PATHNAME "PERSONNEL"
    RDO> DELETE RELATION COLLEGES.
    RDO> COMMIT

    This statement deletes the definition for COLLEGES from the
    database file for PERSONNEL and from the data dictionary.

    Example 2

    Delete more than one relation definition:

    RDO> INVOKE DATABASE PATHNAME "PERSONNEL"
    RDO> DELETE RELATION DEGREES, COLLEGES.
    RDO> COMMIT

    This statement deletes both DEGREES and COLLEGES from the
    database file for PERSONNEL and from the data dictionary.

    Example 3

    Delete a single relation and its associated relation-specific
    constraints from the database. In this case, to delete the
    COLLEGES relation, it is necessary first to delete the DEGREES
    relation and the COLLEGE_CODE_CASCADE_UPDATE trigger because the
    COLLEGES relation has constraints that depend on them.

    RDO> INVOKE DATABASE PATHNAME "PERSONNEL"
    RDO> DELETE RELATION COLLEGES.
    %RDB-E-NO_META_UPDATE, metadata update failed
    -RDMS-F-CONEXI, relation COLLEGES is referenced in constraint
    DEGREES_FOREIGN2
    -RDMS-F-RELNOTDEL, relation COLLEGES has not been deleted
    RDO> DELETE CONSTRAINT DEGREES_FOREIGN2.
    %RDB-E-NO_META_UPDATE, metadata update failed
    -RDMS-F-CONDELVIAREL, constraint DEGREES_FOREIGN2 can only be
    deleted by changing or deleting relation DEGREES
    RDO> DELETE RELATION DEGREES.
    RDO> delete relation colleges.
    %RDB-E-NO_META_UPDATE, metadata update failed
    -RDMS-F-TRGEXI, relation COLLEGES is referenced in
    trigger COLLEGE_CODE_CASCADE_UPDATE
    -RDMS-F-RELNOTDEL, relation COLLEGES has not been deleted
    RDO> DELETE TRIGGER COLLEGE_CODE_CASCADE_UPDATE.
    RDO> DELETE RELATION COLLEGES.
    RDO> COMMIT

    This statement deletes the definition for COLLEGES from the
    database file for PERSONNEL and from the data dictionary.
Close Help