首页 > 数据库技术 > 详细

gen_compile.sql

时间:2016-09-22 16:56:23      阅读:217      评论:0      收藏:0      [点我收藏+]

 

set echo off pagesize 0 feedback off

define v_input_un       = &1
define v_input_pw       = &2
define v_input_conn_str = &3

connect &v_input_un/&v_input_pw@&v_input_conn_str

define v_compile_command_file = .\log\compile_&v_input_un..sql

define v_compile_log_file     = .\log\compile_&v_input_un..log

 

spool &v_compile_command_file
prompt spool &v_compile_log_file
prompt show user
prompt set echo on feedback on pagesize 999

select   ‘alter ‘ || o.object_type ||  ‘ "‘
         || o.object_name || ‘" compile;‘
from     user_objects o
where    o.object_type not like ‘% BODY‘
and      o.object_type not in (‘UNDEFINED‘, ‘JAVA CLASS‘)
and      o.status = ‘INVALID‘
order by decode(o.object_type
              , ‘VIEW‘,      1
              , ‘TYPE‘,      2
              , ‘FUNCTION‘,  3
              , ‘PROCEDURE‘, 4
              , ‘PACKAGE‘,   5
              , 999)
       , o.object_name
/

 

select   ‘alter ‘ ||
         substr(o.object_type, 1, instr(o.object_type, ‘ ‘) - 1)
         ||  ‘ "‘
         || o.object_name || ‘" compile body;‘
from     user_objects o
where    o.object_type like ‘% BODY‘
and      o.object_type not in (‘UNDEFINED‘, ‘JAVA CLASS‘)
and      o.status = ‘INVALID‘
order by decode(o.object_type
              , ‘VIEW‘,      1
              , ‘TYPE‘,      2
              , ‘FUNCTION‘,  3
              , ‘PROCEDURE‘, 4
              , ‘PACKAGE‘,   5
              , 999)
       , o.object_name
/

 

prompt

prompt select * from user_errors order by 1, 2, 3

prompt /

prompt spool off spool off

@&v_compile_command_file

gen_compile.sql

原文:http://www.cnblogs.com/feiyun8616/p/5897035.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!