Defining a foreign key constraint definition
Print
- Last Updated: March 30, 2020
- 2 minute read
- OpenEdge
- Version 12.2
- Documentation
The following steps demonstrate how to define a foreign key constraint.
To define a foreign key constraint definition:
- Start Data Administration and connect to the OpenEdge database you are migrating.
-
Select DataServer > ORACLE Utilities > Server Attributes > View/Maintain Foreign Constraints.
The View/Maintain Foreign Constraint Definitions dialog box appears.
- Select the table for which you are defining a foreign key constraint definition and click Create Constraints. The Create Foreign Constraint Definition for tablename dialog box appears, as shown in figure below.
-
Select FOREIGN KEY from
Constraint Type. The Create Foreign Constraint Definition for
tablename for a foreign key dialog box appears as shown in the
following figure .
Figure 1. Create Foreign Constraint Definition for tablename dialog box for foreign key constraint definitions 
- Accept the default constraint definition name, or enter a new one.
- The Parent Table/Parent Index lists the indexes from all of the other tables defined in the OpenEdge database, available for selection. For the DataServer for Oracle, the list shows primary indexes. Below the parent index information is the Child Index list. The Child Index list shows the available indexes for the selected table. For both parent and child indexes, the Index Key Composite Fields shows the columns that comprise the indexes. Select an index from the parent and child lists with matching composite fields.
- By default, the foreign key constraint definition has the Active check box checked. Leave this box checked if you want the constraint definition you are defining to be available for migration.
-
Select an appropriate action item from the Constraint
Action.
- Constraint actions can be NONE, CASCADE, or SET NULL. A typical constraint action ensures that the data integrity, in case you need to delete data in the rows of a referenced table.
- The NONE constraint action ensures data is not deleted from a row which exists in a foreign key table that references the value in the referenced table.
- The CASCADE constraint action ensures that whenever you delete rows in the master (referenced) table, the respective rows of the child (referencing) table with a matching foreign key column is deleted.
- The SET NULL constraint action ensures
that the foreign key values in the referencing row are set to
NULLwhen the referenced row is deleted.
- Similarly, a row cannot be deleted as long as there is a reference to it from a foreign key table.
- Optionally, add a description of the constraint definition in the Description box.
- Click OK to save the constraint definition and exit the dialog box. Click Create to save the constraint definition and remain in the dialog box to define more constraint definitions for the selected table.