Troubleshooting logic: 1. first, set the tables in the database that contain foreign key constraints to invalid state 2. after all the table data is cleared, the foreign key constraint table is set to available. Specific implementation Script: declarebeginforvv_sqlin (SELECTALTERTABLE | table_name | DISABLECONSTRAINT | CONSTRAINT_NAMEalter_ SQL
Troubleshooting logic: 1. first, set the tables in the database that contain foreign key constraints to invalid state 2. after all the table data is cleared, the table with foreign key constraints is set to available. The specific implementation script is as follows: declare begin for vv_ SQL in (select alter table | table_name | disable constraint | CONSTRAINT_NAME alter_ SQL
Troubleshooting ideas:
1. First, set the table involved in foreign key constraints in the database to invalid.
2. After all the table data is cleared, set the table with foreign key constraints to available.
Specific implementation script:
Declare
Begin
For vv_ SQL in (SELECT 'alter table' | table_name | 'Disable constraint' | CONSTRAINT_NAME alter_ SQL FROM USER_CONSTRAINTS
Where CONSTRAINT_TYPE = 'R ')
Loop
Execute immediate vv_ SQL .alter_ SQL;
End loop;
Execute immediate 'truncate table name;
...... --- Omitted here. Multiple executesql statements can be written.
For vv_ SQL in (SELECT 'alter table' | table_name | 'Enable constraint' | CONSTRAINT_NAME alter_ SQL FROM USER_CONSTRAINTS
Where CONSTRAINT_TYPE = 'R ')
Loop
Execute immediate vv_ SQL .alter_ SQL;
End loop;
End;
/