RDOHELP72.HLB  —  DEFINE_FIELD, Examples
    Example 1: Using DEFINE FIELD

    DEFINE FIELD STANDARD_ID_NUMBER
        DATATYPE IS SIGNED LONGWORD.

    This statement gives a name to the field and specifies its data
    type.

    Example 2: Using DEFINE FIELD with VALID IF

    DEFINE FIELD SEX
       DATATYPE IS TEXT SIZE IS 1
       VALID IF SEX = "M" OR SEX = "F".

    This definition provides validation criteria. When a user tries
    to enter a value other than "M" or "F" in a field that refers to
    this definition, Oracle Rdb returns an error message.

    Example 3: Using DEFINE FIELD with DATATRIEVE Support

    DEFINE FIELD SALARY_AMOUNT
        DATATYPE IS SIGNED LONGWORD
        DEFAULT_VALUE FOR DATATRIEVE IS 0
        EDIT_STRING FOR DATATRIEVE IS "$$$$,$$9.99".

    This example adds a DATATRIEVE edit string and default value to
    the name and data type.

    Example 4: Copying a Field from the data dictionary

    DEFINE FIELD SALARY_AMOUNT
      FROM PATHNAME 'DISK1:[CDDPLUS.DEFS]PERS.SALARY_AMOUNT'.

    This example copies the shareable field, SALARY_AMOUNT, from the
    dictionary.
Close Help