In Oracle, you can use the alter table statement with disable constraint to invalidate the foreign key. The syntax is "alter table table name disable constraint foreign key name;"; if the foreign key fails, the link between the two table data will be cancelled. one or more columns.
The operating environment of this tutorial: Windows 10 system, Oracle 11g version, Dell G3 computer.
Invalidate foreign keys:
alter table tableName disable constraint 外键名称;
We first create a foreign key named fk_supplier through the following code:
In this example, a primary key named supplier_pk is created on the supplier table. It contains only one field - supplier_id field. Then, we created a foreign key named fk_supplier on the products table. The supplier_id field of the products table refers to the supplier_id field of the suppliers table.
If you want to delete this foreign key, you can execute the following command:
Expand knowledge:
Enable foreign key Key recovery:
alter table tableName enable constraint 外键名称;
Delete foreign key:
alter table tableName drop constraint 外键名称;
Recommended tutorial: "Oracle Video Tutorial"
The above is the detailed content of How to invalidate foreign keys in oracle. For more information, please follow other related articles on the PHP Chinese website!