Use the scripts below to enable/disable constraints for an oracle user. You can create them as procedures in your oracle schema, or simply execute them in sqlplus without the create procedure parts.
create or replace procedure sp_ddl_cons_disable as
begin
for c in (select 'ALTER TABLE '|| a.table_name ||' DISABLE constraint ' || a.constraint_name as command
from user_constraints a
where a.constraint_type in ('R'))
loop
---dbms_output.put_line(c.command);
EXECUTE IMMEDIATE (c.command);
end loop;
end;
create or replace procedure sp_ddl_cons_enable as
begin
for c in (select 'ALTER TABLE '|| a.table_name ||' ENABLE constraint ' || a.constraint_name as command
from user_constraints a
where a.constraint_type in ('R'))
loop
---dbms_output.put_line(c.command);
EXECUTE IMMEDIATE (c.command);
end loop;
end;
No comments:
Post a Comment