CDO$HELP.HLB  —  CDO Commands, DEFINE  GENERIC Relationship Member Options, Examples
    1.CDO>  DEFINE GENERIC CDD$EXECUTABLE_IMAGE MY_PROGRAM_EXE
      cont>   MCS_PROCESSINGNAME "MY_PROGRAM_EXE".
      cont> RELATIONSHIPS.
      cont>   RELATIONSHIP CDD$IMAGE_DERIVED_FROM
      cont>     GENERIC CDD$COMPILED_MODULE
      cont>     MCS_PROCESSINGNAME "INPUT_MODULE_OBJ".
      cont>       RELATIONSHIPS.
      cont>         RELATIONSHIP CDD$COMPILED_DERIVED_FROM
      cont>           INPUT_MODULE_COB.
      cont>         END CDD$COMPILED_DERIVED_FROM RELATIONSHIP.
      cont>       END RELATIONSHIPS.
      cont>     END CDD$COMPILED_MODULE INPUT_MODULE_OBJ.
      cont>   END CDD$IMAGE_DERIVED_FROM RELATIONSHIP.
      cont>   RELATIONSHIP CDD$IMAGE_DERIVED_FROM
      cont>     GENERIC CDD$COMPILED_MODULE
      cont>     MCS_PROCESSINGNAME "OUTPUT_MODULE_OBJ".
      cont>       RELATIONSHIPS.
      cont>         RELATIONSHIP CDD$COMPILED_DERIVED_FROM
      cont>           OUTPUT_MODULE_COB.
      cont>         END CDD$COMPILED_DERIVED_FROM RELATIONSHIP.
      cont>       END RELATIONSHIPS.
      cont>     END CDD$COMPILED_MODULE OUTPUT_MODULE_OBJ.
      cont>   END CDD$IMAGE_DERIVED_FROM RELATIONSHIP.
      cont> END RELATIONSHIPS.
      cont> END CDD$EXECUTABLE_IMAGE MY_PROGRAM_EXE.

      In this example, the following steps are performed:

      a. Defines the generic entity MY_PROGRAM_EXE.

      b. Specifies the processing name MY_PROGRAM_EXE for the
         CDD$PROCESSING_NAME attribute.

      c. Defines the list of relationships that the definition MY_
         PROGRAM_EXE includes.

      d. Specifies a relationship type CDD$IMAGE_DERIVED_FROM,
         supplied by Oracle CDD/Repository, that the definition MY_
         PROGRAM_EXE owns.

      e. The GENERIC clause creates a generic entity as a
         relationship member of the CDD$IMAGE_DERIVED_FROM
         relationship, based on the CDD$COMPILED_MODULE entity type.

      f. Specifies the processing name INPUT_MODULE for the attribute
         type CDD$PROCESSING_NAME, supplied by Oracle CDD/Repository.

      g. Begins the list of relationships that the generic entity
         definition INPUT_MODULE_OBJ includes.

      h. Specifies the relationship type CDD$COMPILED_DERIVED_
         FROM, which is supplied by Oracle CDD/Repository, as a
         relationship owned by the generic entity INPUT_MODULE_OBJ.
         This relationship type specifies the generic entity INPUT_
         MODULE_COB (based on the entity type CDD$SOURCE_MODULE) as
         its relationship member.

      i. Ends the relationship definition of CDD$COMPILED_DERIVED_
         FROM.

      j. Ends the list of relationships the generic entity definition
         INPUT_MODULE_OBJ owns.

      k. Ends the definition of the generic entity INPUT_MODULE_OBJ.

      l. Ends the CDD$IMAGE_DERIVED_FROM relationship definition that
         MY_PROGRAM_EXE owns.

      m. Specifies a relationship type CDD$IMAGE_DERIVED_FROM,
         supplied by Oracle CDD/Repository, that the generic entity
         definition MY_PROGRAM_EXE owns.

      n. The GENERIC clause creates a generic entity as a
         relationship member of the CDD$IMAGE_DERIVED_FROM
         relationship, based on the CDD$COMPILED_MODULE entity type.

      o. Specifies the processing name OUTPUT_MODULE_OBJ for the
         attribute type CDD$PROCESSING_NAME, which is supplied by
         Oracle CDD/Repository.

      p. Begins the list of relationships that the new generic entity
         definition OUTPUT_MODULE_OBJ includes.

      q. Specifies the relationship type CDD$COMPILED_DERIVED_FROM,
         supplied by Oracle CDD/Repository, as a relationship owned
         by the generic entity OUTPUT_MODULE_OBJ. This relationship
         type specifies the generic entity OUTPUT_MODULE_COB (based
         on the entity type CDD$SOURCE_MODULE as its relationship
         member.

      r. Ends the relationship definition of CDD$COMPILED_DERIVED_
         FROM.

      s. Ends the list of relationships that the generic entity
         definition OUTPUT_MODULE_OBJ owns.

      t. Ends the definition of the generic entity definition OUTPUT_
         MODULE_OBJ.

      u. Ends the CDD$IMAGE_DERIVED_FROM relationship definition that
         MY_PROGRAM_EXE owns.

      v. Ends the list of relationships the generic entity MY_
         PROGRAM_EXE owns.

      w. Ends the definition of the generic entity MY_PROGRAM_EXE.

      Because the GENERIC clause of the DEFINE GENERIC command
      creates the INPUT_OBJ and OUTPUT_OBJ generic entities, these
      entities do not have directory names. You can view their
      definitions only with the SHOW GENERIC/FULL command, which
      displays their owner (MY_PROGRAM_EXE entity).

    2.CDO> SHOW GENERIC CDD$EXECUTABLE_IMAGE/FULL MY_PROGRAM_EXE
      Definition of MY_PROGRAM_EXE   (Type : CDD$EXECUTABLE_IMAGE)
       |   Contains CDD$IMAGE_DERIVED_FROM
       |   |   INPUT_MODULE_OBJ                    (Type : CDD$COMPILED_MODULE)
       |   |   |   Contains CDD$COMPILED_DERIVED_FROM
       |   |   |   |   INPUT_MODULE_COB               (Type : CDD$SOURCE_MODULE)
       |   Contains CDD$IMAGE_DERIVED_FROM
       |   |   OUTPUT_MODULE_OBJ                   (Type : CDD$COMPILED_MODULE)
       |   |   |   Contains CDD$COMPILED_DERIVED_FROM
       |   |   |   |   OUTPUT_MODULE_COB              (Type : CDD$SOURCE_MODULE)

      In this example, the DEFINE GENERIC command creates the
      generic element definition MY_PROGRAM_EXE, based on the
      type CDD$EXECUTABLE_IMAGE. The first relationship defined
      is the CDD$IMAGE_DERIVED_FROM relation, supplied by Oracle
      CDD/Repository, which in turn owns the CDD$COMPILED_DERIVED_
      FROM relation, also supplied by Oracle CDD/Repository. The
      second relationship defined is a CDD$IMAGE_DERIVED_FROM
      relation, which in turn owns another CDD$COMPILED_DERIVED_
      FROM relation.

      The first relationship links the executable image and its
      compiled modules. The second relationship links the compiled
      modules and the source module.

    3.CDO> DEFINE GENERIC BOOK CDD_PLUS_REFERENCE_MANUAL
      cont> MCS_processingName IS "CDD_PLUS_REFERENCE_MANUAL"
      cont> LIBRARY_NUMBER IS "AA-KL45A-TE".
      cont> END BOOK CDD_PLUS_REFERENCE_MANUAL.

      This example creates an entity named CDD_PLUS_REFERENCE_MANUAL
      based on the BOOK protocol.

    4.CDO> DEFINE GENERIC LIBRARY ORACLE_LIBRARY
      cont> MCS_processingName IS "ORACLE_LIBRARY"
      cont> ADDRESS IS "NASHUA, NH".
      cont> RELATIONSHIPS.
      cont> RELATIONSHIP BOOK_IN_LIBRARY CDD_PLUS_REFERENCE_MANUAL
      cont> END BOOK_IN_LIBRARY RELATIONSHIP.
      cont> END RELATIONSHIPS.
      cont> END LIBRARY ORACLE_LIBRARY.

      This example creates an entity named ORACLE_LIBRARY based on
      the LIBRARY protocol.

    5.CDO> DEFINE GENERIC LIBRARY ORACLE_LIBRARY
      cont> MCS_processingName IS "ORACLE_LIBRARY".
      cont> RELATIONSHIPS.
      cont> RELATIONSHIP BOOK_IN_LIBRARY CDO_REFERENCE_MANUAL.
      cont> END BOOK_IN_LIBRARY RELATIONSHIP.
      cont> RELATIONSHIPS.
      cont> GENERIC BOOK USER_GUIDE
      cont> MCS_processingName IS "USER_GUIDE".
      cont> END RELATIONSHIPS.
      cont> END LIBRARY ORACLE_LIBRARY.

      This command creates a relationship member using the DEFINE
      GENERIC command.

    6.CDO> DEFINE GENERIC LIBRARY ORACLE_LIBRARY
      cont>    MCS_processingName IS "ORACLE_LIBRARY"
      cont>    ADDRESS IS "NASHUA, NH".
      cont>    RELATIONSHIPS.
      cont>      RELATIONSHIP BOOK_IN_LIBRARY
      cont>        GENERIC BOOK
      cont>        MCS_processingName IS "USER_GUIDE"
      cont>    END RELATIONSHIPS.
      cont> END LIBRARY ORACLE_LIBRARY.

      This example uses the DEFINE GENERIC command to define the
      relationship member USER_GUIDE. Note that the keyword DEFINE
      and the relationship member's entity name have been omitted.

    7.CDO> DEFINE GENERIC LIBRARY ORACLE_LIBRARY
      cont>    MCS_processingName IS "ORACLE_LIBRARY"
      cont>    ADDRESS IS "NASHUA, NH".
      cont>    RELATIONSHIPS.
      cont>      RELATIONSHIP BOOK_IN_LIBRARY
      cont>        GENERIC BOOK
      cont>        MCS_processingName IS "USER_GUIDE"
      cont>        LIBRARY_NUMBER IS 1.
      cont>        END GENERIC.
      cont>      END BOOK_IN_LIBRARY RELATIONSHIP.
      cont>    END RELATIONSHIPS.
      cont> END LIBRARY ORACLE_LIBRARY.

      This example uses the DEFINE GENERIC command to define the
      relationship member USER_GUIDE. Note that the keyword DEFINE
      and the relationship member's entity name have been omitted.

    8.CDO> SHOW GENERIC LIBRARY ORACLE_LIBRARY

      To view the definition of the relationship member created with
      the DEFINE GENERIC command in the previous example, you need to
      use the SHOW GENERIC command for its owner, ORACLE_LIBRARY.

    9.CDO>  DEFINE GENERIC CDD$RDB_DATABASE PERSONNEL DESCRIPTION IS
      cont> "DEFINE RDB_DATABASE PERSONNEL, CONTAINING RECORD EMPLOYEE_REC"
      cont> CDD$PROCESSING_NAME IS "PERSONNEL".
      cont> RELATIONSHIPS.
      cont>  RELATIONSHIP CDD$RDB_DATA_AGGREGATE
      cont>    GENERIC CDD$DATA_AGGREGATE DESCRIPTION IS
      cont>    "DEFINE DATA AGGREGATE EMPLOYEE_REC CONTAINING FIRST_NAME,"
      cont>    "LAST_NAME, EMP_ID"
      cont>    CDD$PROCESSING_NAME IS "EMPLOYEE_REC".
      cont>      RELATIONSHIPS.
      cont>        RELATIONSHIP CDD$DATA_AGGREGATE_CONTAINS
      cont>          GENERIC CDD$DATA_ELEMENT DESCRIPTION IS
      cont>          "DEFINE DATA ELEMENT FIRST_NAME = FIELD FIRST_NAME"
      cont>          CDD$PROCESSING_NAME IS "FIRST_NAME"
      cont>          CDD$DATA_ELEMENT_DATATYPE 14
      cont>          CDD$DATA_ELEMENT_LENGTH 10.
      cont>          END CDD$DATA_ELEMENT FIRST_NAME.
      cont>        CDD$DATA_SEQUENCE_NUMBER IS 1.
      cont>        END CDD$DATA_AGGREGATE_CONTAINS RELATIONSHIP.
      cont>        RELATIONSHIP CDD$DATA_AGGREGATE_CONTAINS
      cont>          GENERIC CDD$DATA_ELEMENT DESCRIPTION IS
      cont>          "DEFINE DATA ELEMENT LAST_NAME = FIELD LAST_NAME"
      cont>          CDD$PROCESSING_NAME IS "LAST_NAME"
      cont>          CDD$DATA_ELEMENT_DATATYPE 14
      cont>          CDD$DATA_ELEMENT_LENGTH 15.
      cont>          END CDD$DATA_ELEMENT LAST_NAME.
      cont>        CDD$DATA_SEQUENCE_NUMBER IS 2.
      cont>        END CDD$DATA_AGGREGATE_CONTAINS RELATIONSHIP.
      cont>        RELATIONSHIP CDD$DATA_AGGREGATE_CONTAINS
      cont>          GENERIC CDD$DATA_ELEMENT DESCRIPTION IS
      cont>          "DEFINE DATA ELEMENT EMP_ID = FIELD EMP_ID"
      cont>          CDD$PROCESSING_NAME IS "EMP_ID"
      cont>          CDD$DATA_ELEMENT_DATATYPE 4.
      cont>          END CDD$DATA_ELEMENT EMP_ID.
      cont>        CDD$DATA_SEQUENCE_NUMBER IS 3.
      cont>        END CDD$DATA_AGGREGATE_CONTAINS RELATIONSHIP.
      cont>      END RELATIONSHIPS.
      cont>    END CDD$DATA_AGGREGATE EMPLOYEE_REC.
      cont>  END CDD$RDB_DATA_AGGREGATE RELATIONSHIP.
      cont>END RELATIONSHIPS.
      cont>END CDD$RDB_DATABASE PERSONNEL.

      This example defines an Oracle Rdb database PERSONNEL and
      creates a CDD$RDB_DATABASE entity PERSONNEL in the CDO
      repository. This database contains one record EMPLOYEE_REC,
      which in turn contains three fields that were defined by
      nesting the GENERIC clauses: FIRST_NAME, LAST_NAME, and EMP_
      ID. (It is recommended that you define Oracle Rdb databases in
      the CDO repository through the SQL. See Oracle Rdb7 Guide to
      Database Design and Definition for more information on how to
      use CDO with Oracle Rdb databases.)

    10 CDO> SHOW GENERIC CDD$RDB_DATABASE/AUDIT=ALL PERSONNEL
       Definition of PERSONNEL   (Type : CDD$RDB_DATABASE)
       |   |   History entered by SMITH ([CDD,SMITH])
       |   |    using CDO V1.0
       |   |    to CREATE definition on 15-DEC-1987 10:31:11.59
       |   Contains CDD$RDB_DATA_AGGREGATE
       |   |   EMPLOYEE_REC                    (Type : CDD$DATA_AGGREGATE)
       |   |   |   Contains CDD$DATA_AGGREGATE_CONTAINS
       |   |   |   |   FIRST_NAME                      (Type : CDD$DATA_ELEMENT)
       |   |   |   Contains CDD$DATA_AGGREGATE_CONTAINS
       |   |   |   |   LAST_NAME                       (Type : CDD$DATA_ELEMENT)
       |   |   |   Contains CDD$DATA_AGGREGATE_CONTAINS
       |   |   |   |   EMP_ID                          (Type : CDD$DATA_ELEMENT)
       CDO>

      This example displays the history list of every element owned
      by the PERSONNEL database by using the SHOW GENERIC command.
Close Help