set linesize 80;
set pagesize 10000;
set long 50;
set echo on;

/* ************************************************ */
/*                                                  */
/* Author            : Rick Kupcunas                */
/*                   : rick@kupcunas.com            */
/* Original          : 2000-Jun-05                  */
/*                                                  */
/* This script will "touch" all invalid views which */
/*   will make the views valid (if possible)        */
/*                                                  */
/* ************************************************ */

col dummy     noprint format a1;

/* ********************************* */
/* 1. Generate drop table commands   */
/* 2. Generate create table commands */
/* ********************************* */

/* select 'select * from '||owner||'.'||object_name||' where rownum < 1;' */
select 'alter view '||owner||'.'||object_name||' compile;'
from dba_objects
where status = 'INVALID' 
and object_type = 'VIEW'
ORDER BY 1;

spool touch_invalid_views.rslt
/
spool off;
undefine schema;
commit;

@touch_invalid_views.rslt
