Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

Format

More

Examples

RDB/VMS Relational Database Operator DELETE_RELATION — VMS RDB_3.1A

 Deletes one or more relation definitions and all associated
 relation-specific constraints.  When the DELETE RELATION statement
 executes, Rdb/VMS 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 use the PATHNAME qualifier when you invoke the
 database, the DELETE RELATION statement also deletes the relation
 definition from the data dictionary.  You CANNOT delete a relation
 definition when there are active users.

 Example:

      DELETE RELATION COLLEGES.

Additional information available:

FormatMoreExamples

Format

 DELETE RELATION ───┬────> relation-name ────┬─────> .
                    └─────<───── , <─────────┘

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

More

 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, Rdb/VMS
 starts a read/write transaction implicitly.

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

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.

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026