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 As
Strsql Varchar2(200);
Begin
For x In (Select Object_Name From All_Objects Where Status = 'INVALID' And Object_Type = 'PROCEDURE') Loop
Strsql := '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
一起学吧部分文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与一起学吧进行文章共享合作。