Format DEFINE FIELD field-name [ DESCRIPTION IS /*text*/ ] [ AUDIT IS /*text*/ ] [ field-property ] ... .
1 – Parameters
1.1 – field-name
Specifies the field element you are creating.
1.2 – text
Adds information. Within the DESCRIPTION clause, this is information documenting the field element; within the AUDIT clause, it is a history list entry. Valid delimiters are /* */ or double quotation marks (" "). You can use Japanese to document comments in the DESCRIPTION or AUDIT clause for a field. To do this, use the SET CHARACTER_SET command, and set the character_set of the session to DEC_KANJI.
1.3 – field-property
Adds a property to the field element. See fld-properties for the field properties CDO provides.
2 – Description
The DEFINE FIELD command creates a field element. If the field element is controlled, you use the DEFINE FIELD command to create the initial version of the element. Use the RESERVE and REPLACE commands to create new versions. If the field element is uncontrolled, use the DEFINE FIELD command to create both initial and new versions. You can create a field element in a directory other than your default directory by specifying the appropriate path name. If you supply a field name that is already used for a field element in your default directory, CDO creates a new version of the existing field definition. The DEFINE FIELD command evaluates the field name you supply to determine if it is a logical name. If the field name is a logical name, CDO translates it. In some cases, the translation of the logical name for the field name may not be a valid name for a field definition, and CDO will not create the field definition. For example, if you have defined JOE as a logical name that translates to MYNODE::[RICHIE], CDO translates the symbol JOE. The following DEFINE FIELD command fails because MYNODE::[RICHIE] is not a valid field name: CDO> DEFINE FIELD JOE. %CDO-F-ERRDEFINE, error defining object -CDD-F-NOTADIC, Does not contain an Oracle CDD/Plus dictionary: MYNODE:: If this error occurs, deassign the logical name with the same name as the object, and perform the operation again. To avoid this logical name conflict, use unique names that represent the type of entity you are naming.
3 – Examples
1.CDO> DEFINE FIELD POSTAL_CODE cont> DESCRIPTION IS /* A 5 DIGIT POSTAL_CODE */ cont> AUDIT IS /* WILL BE CHANGED TO 9 DIGITS EVENTUALLY */ cont> DATATYPE IS UNSIGNED LONGWORD cont> SIZE IS 5 DIGITS. In this example, the DEFINE FIELD command creates the POSTAL_ CODE field element. 2.CDO> DEFINE FIELD SEX cont> DATATYPE IS TEXT SIZE IS 1 cont> VALID IF SEX = "M" OR SEX = "F". In this example, the DEFINE FIELD command creates the SEX field element. The VALID IF field property returns an error if you attempt to store a value other than M or F in the field that refers to this element.