作者:手机用户2602935405 | 来源:互联网 | 2023-07-23 16:38
在SQL_PLUS中:spoolExecCompProc.sqlselectalterprocedure||object_name||compile;Fromall_objects
在SQL_PLUS中:
spool ExecCompProc.sql select 'alter procedure
'||object_name||' compile;' From all_objects
where status = 'INVALID' and object_type = 'PROCEDURE';
spool off @ExecCompProc.Sql;
整理成一个存储过程:
Create Or Replace Procedure Zl_Compile_Invalid_Procedure
AsStrsql Varchar2(200);BeginFor x In (Select Object_Name
From All_Objects Where Status = 'INVALID'
And Object_Type = 'PROCEDURE') LoopStrsql := 'Alter
Procedure ' || x.Object_Name || ' Compile';Begin Execute
Immediate Strsql; Exception--When Others Then Null;
When OTHERS Then dbms_output.put_line(Sqlerrm);
End;End Loop;End;
最后执行:
exec Zl_Compile_Invalid_Procedure;
如果要看到无法重编译的过程的出错信息,需要执行前设置set serverout on。
标签:
本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,尊重他人劳动成果
0
好文不易,鼓励一下吧!