RDB/VMS Relational Database Operator DELETE_FIELD — VMS RDB_4.0B
Deletes one or more field definitions. When the DELETE FIELD
statement executes, Rdb/VMS deletes the field definition from the
physical database. If you invoke the database using the PATHNAME
qualifier, Rdb/VMS also deletes the field definition from the data
dictionary. You can delete any named field, whether it was defined
with a DEFINE FIELD statement or with a DEFINE RELATION statement.
However, you cannot delete a field that is referred to in the
definition of a relation, index, or constraint:
Example:
DELETE FIELD POSTAL_CODE.
Additional information available:
More
o You must have the Rdb/VMS DELETE privilege for a field to delete
the field with the DELETE FIELD statement.
o If you want to delete a field that is part of a relation
definition, you must use the CHANGE RELATION statement to delete
the field from the relation definition, or you must delete the
entire relation.
o If you want to delete a field that is referred to in a constraint
or index definition, you must first delete the constraint or
index.
o You cannot delete a field definition unless you have invoked the
database that includes the field.
o You can delete a field definition even when there are active
users. Deleting a field definition will not affect active users
until they exit their session and invoke the database the next
time.
o 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.
Format
DELETE FIELD ───┬───> field-name ────┬───> . └────<──── , ────<───┘ field-name The name of the field whose definition you want to delete.
Examples
Example 1 Delete a single field definition: RDO> INVOKE DATABASE PATHNAME 'PERSONNEL' RDO> START_TRANSACTION READ_WRITE RDO> DELETE FIELD TEMP_NUM. RDO> COMMIT This sequence deletes the field definition from the physical database and the data dictionary. Example 2 Delete more than one field definition: RDO> INVOKE DATABASE PATHNAME 'PERSONNEL' RDO> START_TRANSACTION READ_WRITE RDO> DELETE FIELD TEMP_NUM, MONEY. RDO> COMMIT This sequence deletes the definitions for the TEMP_NUM and MONEY fields from the physical database and the data dictionary dictionary. Example 3 Delete a field from a relation: RDO> INVOKE DATABASE PATHNAME 'PERSONNEL' RDO> START_TRANSACTION READ_WRITE RDO> DELETE FIELD STATUS_NAME. %RDO-W-NOCDDUPDAT, database invoked by filename, the CDD will not be updated %RDB-E-NO_META_UPDATE, metadata update failed %RDMS-F-RELEXI, field STATUS_NAME is used in relation, WORK_STATUS -RDMS-F-FLDNOTDEL, field STATUS_NAME has not been deleted RDO> CHANGE RELATION WORK_STATUS. cont> DELETE STATUS_NAME. cont> END. RDO> DELETE FIELD STATUS_NAME. RDO> COMMIT If a field is used in a relation, you need to perform two operations to delete it: o Change the relation by deleting the field. o Delete the global field definition.