Home > SQL Developer: TimesTen Tasks > Create a Foreign Key Constr...
You can create a foreign key constraint on a table. Make sure you are on the main SQL Developer page and that your TimesTen connection is expanded.
Click the + to the left of the Tables node to expand the list of tables.
Right-click the name of the table and select Constraint, then select Add Foreign Key.
The Add Foreign Key dialog displays. The Owner and Name fields are auto-filled and you cannot edit these fields. Prepare to enter the Constraint Name.
To enable the ON DELETE CASCADE
referential action, select the Cascade delete foreign key checkbox. If specified, when rows containing referenced key values are deleted from a parent table, rows in child tables with dependent foreign key values are also deleted.
In the Constraint Name field, enter the name of the foreign key.
Select the column on which to apply the foreign key constraint from the Column Name drop-down list.
Select the table name that the foreign key references from the Referenced Table Name drop-down list.
Select the column that the foreign key references from the Referenced Column drop-down list.
To view the SQL statement that will be used to create the foreign key constraint, choose the SQL tab of the Add Foreign Key dialog box.
Click Apply.
The Confirmation dialog box displays indicating that the foreign key constraint has been added.
Click OK.
The foreign key constraint has been added successfully.
For information about creating a foreign key constraint, see "CREATE TABLE" in the Oracle TimesTen In-Memory Database SQL Reference or "ALTER TABLE" in the Oracle TimesTen In-Memory Database SQL Reference.
Related Topics