set head off
set feed off
set pages 0
set ver off

--Genera script de desactivación

prompt
prompt -- DESHABILITAR CONSTRAINTS: /tmp/discons.sql 
prompt

spool /tmp/discons.sql

prompt
prompt spool /tmp/discons.log
prompt

select 'ALTER TABLE "'||OWNER||'"."'||TABLE_NAME||'" MODIFY CONSTRAINT "'||CONSTRAINT_NAME||'" DISABLE;'
from dba_constraints
where owner=upper('&1')
and status!='DISABLED'
/

prompt
prompt spool off
prompt

spool off

-- Genera script de activación

prompt
prompt -- HABILITAR RESTRICCIONES: /tmp/encons.sql
prompt

spool /tmp/encons.sql

prompt
prompt spool /tmp/encons.log
prompt


select 'ALTER TABLE "'||OWNER||'"."'||TABLE_NAME||'" MODIFY CONSTRAINT "'||CONSTRAINT_NAME||'" ENABLE;'
from dba_constraints
where owner=upper('&1')
and status!='DISABLED'
/

prompt
prompt spool off
prompt

spool off;

set head on
set feed on
set pages 80
set ver on
