« Oracle: info about the corrupted block | Home | Oracle: using substitution variables in sqlplus »

Oracle: disable all constraints referencing the table


begin
for cur in (select fk.owner, fk.constraint_name , fk.table_name
from all_constraints fk, all_constraints pk
where fk.CONSTRAINT_TYPE = 'R' and
pk.owner = '&which_owner' and
fk.R_CONSTRAINT_NAME = pk.CONSTRAINT_NAME
and pk.TABLE_NAME = '&which_table'
) loop
execute immediate 'ALTER TABLE '||cur.owner||'.'||cur.table_name||' MODIFY CONSTRAINT '||cur.constraint_name||' DISABLE';
end loop;
end;

Topics: Oracle | Submitter: checkthis

One Response to “Oracle: disable all constraints referencing the table”

  1. oracle disable all constraints Says:
    June 21st, 2008 at 5:42 am

    [...] referencing the table. begin FOR cur IN SELECT fk.owner, fk.constraint_name , fk.table_name ...http://code.techinterviews.com/oracle-disable-all-constraints-referencing-the-table/109SQL Statements: ALTER TABLE to constraint_clause, 2 of 14To enable or disable triggers, the triggers [...]

Comments

You must be logged in to post a comment.