| Oracle Help for the Web | Contents | Index | Search | View Topic |
| Field Descriptions | Related
Help Topics | Additional Information
| Locating this Page |
Use this page to optionally create or edit a FOREIGN KEY constraint.
A foreign key constraint designates one or more table columns whose values relate to values in a unique or primary key column. The value of the foreign key must appear as a primary key value in one of the table's rows.
For example, the SCOTT.EMP table could contain a DEPTNO foreign key column that is related to a DEPTNO primary key in the SCOTT.DEPT table.
When
creating a table, you cannot create a foreign key constraint that refers to
a foreign key within the table you are creating. If you want to create this
kind of recursive relationship, you must first create the table, and then edit
it to add the foreign key constraint.
| Field | Description |
|---|---|
| Constraint Name | Enter the name that will identify the constraint. |
| Cascade Delete | Select to delete all table rows dependant on the primary key when a row containing the primary key is deleted. For example, you could delete a row containing 10 as the value of the primary key DEPTNO in the SCOTT.DEPT table. All dependent rows in the SCOTT.EMP table that contain DEPTNO equal to 10 would also be deleted when the row in SCOTT.DEPT is deleted. |
| Foreign Table | Choose a table that contains one or more primary keys on which to base your FOREIGN KEY constraint. |
| Retrieve Keys | Click to populate the Retrieved Keys list with the primary key or foreign keys in the Foreign Table. |
| Field | Description |
|---|---|
| Columns | Displays columns containing a primary or foreign key. |
| Keys | Displays whether the column is a primary or foreign key. |
| More | Click to add more keys. |
| Add to List | Click to create a foreign key constraint. The new constraint will be added to the Existing Constraints list below. |
| Field | Description |
|---|---|
| Name | Displays the name of an existing constraint. Click |
| Selected Columns | Displays the column(s) on which the constraint is based. |
| Enable/Disable | Select to cause the Oracle database to enforce the constraint when its conditions are met. Deselect to disable the constraint. |
To locate this page in OracleAS Portal: