热门文章 | 热门软件| 热门源码 | 热门电影 | 知识库 | 联系我们
软件 源码 教程 影视 健康 招聘
  HTML | JavaScript | ASP | PHP | JSP | NET | VB | VC | VF | Windows | Linux | Mysql | Mssql | Oracle | Struts 
当前位置: 创世纪计算机资源网 -> 文章频道 ->oracle 
站内搜索:
在Oracle中重编译所有无效的存储过程
作者:不详 来源:互联网 整理日期:2007-8-17

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

 

相关文章