Disable foreign key

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

Syntax

ALTER TABLE table_name
DISABLE CONSTRAINT constraint_name;

Disable foreign key example

  
ALTER TABLE ORDERS
DISABLE CONSTRAINT fk_course;

Output:

table ORDERS altered.

Check constraints

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

Output:

OWNER CONSTRAINT_NAME STATUS
SYSTEM FK_COURSE DISABLED