Try OpenEdge Now
skip to main content
DataServer for Oracle
The DataServer Tutorial : Managing server attributes : Defining constraint definitions in Data Administration : Defining a foreign key constraint definition
 
Defining a foreign key constraint definition
The following steps demonstrate how to define a foreign key constraint.
To define a foreign key constraint definition:
1. Start Data Administration and connect to the OpenEdge database you are migrating.
2. Select DataServer > ORACLE Utilities > Server Attributes > View/Maintain Foreign Constraints. The View/Maintain Foreign Constraint Definitions dialog box appears.
3. 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 above.
4. 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 17. Create Foreign Constraint Definition for tablename dialog box for foreign key constraint definitions
5. Accept the default constraint definition name, or enter a new one.
6. 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.
7. 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.
8. 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 NULL when the referenced row is deleted.
9. Similarly, a row cannot be deleted as long as there is a reference to it from a foreign key table.
10. Optionally, add a description of the constraint definition in the Description box.
11. 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.