Oracle Database Disable all related foreign keys in oracle


Suppose you have the table T1 and it has relation with many tables and its primary key constraint name is "pk_t1" you want to disable these foreign keys you can use:

    For I in (select table_name, constraint_name from user_constraint t where   r_constraint_name='pk_t1') loop

Execute immediate ' alter table ' || I.table_name || ' disable constraint ' || i.constraint_name;

   End loop;