enrique_aeo
asked on
oracle Disable the constraints of the tables
Good morning, I'm doing a data migration script, my question is:
is a good choice?
1. Disable the constraints of the tables
2. Inserting data
3. Enabling constraints for tables
If yes, please indicate the code to disable the contraints of 8 tables
Thanks
is a good choice?
1. Disable the constraints of the tables
2. Inserting data
3. Enabling constraints for tables
If yes, please indicate the code to disable the contraints of 8 tables
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you just want to hack stuff in, I would not recommend it for production data, but I have done it for testing purposes.
The following will drop constraints tied to a table:
declare v_command varchar2(500);
begin
for fk in (select child_owner, child_table_name, constraint_name as fk_name
from adm.vw_constraints
where (parent_owner = '<OWNER>' and parent_table_name = '<TABLE_NAME>' and status = 'ENABLED') or
child_owner = '<OWNER>' and child_table_name = '<TABLE_NAME>' and status = 'ENABLED') loop
v_command := 'alter table ' || fk.child_owner||'.'||fk.ch
execute immediate v_command;
end loop;
end;
/