Enable a foreign key

To enable a foreign key on a table of Oracle database you must use the alter table command and enable constraint keyword.

Syntax

ALTER TABLE table_name
ENABLE CONSTRAINT constraint_name;

Enable foreign key example

  
ALTER TABLE ORDERS
ENABLE CONSTRAINT fk_course;

Output:

table ORDERS altered.

Check constraints

SELECT OWNER, CONSTRAINT_NAME, STATUS
FROM user_constraints
WHERE table_name = 'ORDERS';

Output:

OWNERCONSTRAINT_NAMESTATUS
SYSTEMFK_COURSEENABLED