在Oracle中重编译所有无效的存储过程
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
轉載于:https://www.cnblogs.com/zyk/archive/2006/04/04/366452.html
總結
以上是生活随笔為你收集整理的在Oracle中重编译所有无效的存储过程的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: JQuery Datatables Do
- 下一篇: 爱情需要表达