1 DELETE_FIELD Deletes one or more field definitions. When the DELETE FIELD statement executes, Oracle Rdb deletes the field definition from the physical database. If you invoke the database using the PATHNAME argument, Oracle Rdb also deletes the field definition from the CDD$DATABASE definition of the database in 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. 2 More o You must have the Oracle Rdb 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. By default, a database can be opened automatically (that is, by any user who invokes the database and executes a data manipulation language statement). If the database was modified so that it must be manually opened, the RMU/OPEN command must be used to open it. o 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. 2 Format (B)0DELETE FIELD qqqwqqq> field-name qqqqwqqq> . mqqqq 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. 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 data dictionary 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.