BEGIN
FOR c IN
(SELECT c.owner, c.table_name, c.constraint_name
FROM user_constraints c, user_tables t
WHERE c.table_name = t.table_name
AND c.status = 'ENABLED'
ORDER BY c.constraint_type DESC)
LOOP
dbms_utility.exec_ddl_statement('alter table ' || c.owner || '.' ||
c.table_name || ' disable constraint ' || c.constraint_name);
END LOOP;
END;
/
BEGIN
FOR c IN
(SELECT c.owner, c.table_name, c.constraint_name
FROM user_constraints c, user_tables t
WHERE c.table_name = t.table_name
AND c.status = 'DISABLED'
ORDER BY c.constraint_type)
LOOP
dbms_utility.exec_ddl_statement('alter table ' || c.owner || '.' ||
c.table_name || ' enable constraint ' || c.constraint_name);
END LOOP;
END;
/
select 'ALTER TABLE '||substr(c.table_name,1,35)|| ' DISABLE CONSTRAINT
'||constraint_name||' ;' from user_constraints c, user_tables u where c.table_name = u.table_name;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/20500445/viewspace-708606/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/20500445/viewspace-708606/