Oracle foreign key for table data synchronization method 1: When deleting data in a table with a parent-child table relationship, we all know that we need to delete the child table before deleting the data in the parent table, or cancel the foreign key and then delete it. Yesterday, we used to delete the child table first, then the parent table, and truncate to delete the child table. The following message is displayed when we delete the parent table: "Unique/foreign key reference enabled for the primary key in the table ". If it is changed to delete, the deletion is successful. The online explanation is the difference between ddl and dml. This is another difference between truncate and delete. Method 2: alter table t_user disable primary key cascade; truncate table t_user; alter table t_user enable primary key; insert into t_user ..... commit; -- query the table's primary key constraint name select * from user_constraints e where e. table_name = ''; -- enter the table name here -- Query all records that reference the primary key select B. table_name, B. column_name from user_constraints a inner join user_cons_columns B on. constraint_name = B. constraint_name where. r_constraint_name = ''; -- here Enter the constraint name of the table primary key just queried. Method 3: 1. The foreign key constraint names in the ORACLE database can be found in the user_constraints table. Constraint_type = 'R' indicates a foreign key constraint. 2. The command for enabling foreign key constraints is: alter table name enable constraint name 3. The command for disabling foreign key constraints is: alter table name disable constraint name 4. Then use SQL to find the constraint names of all foreign keys in the database: select 'alter table' | table_name | 'Enable constraint' | constraint_name | '; 'From user_constraints where constraint_type = 'R' select 'alter table' | table_name | 'Disable constraint' | constraint_name | ';' from user_constraints where constraint_type = 'R'