日期:2014-05-16 浏览次数:20424 次
--编译某个用户下的无效存储过程
create or replace procedure compile_invalid_procedures(
p_owner varchar2 -- 所有者名称,即 SCHEMA
) as
--编译某个用户下的无效存储过程
?str_sql varchar2(1000);
?begin
?for invalid_procedures in (select object_name from dba_objects
?where status = 'INVALID' and object_type = 'PROCEDURE' and owner=upper(p_owner))
??? loop
??str_sql := 'alter procedure ' ||invalid_procedures.object_name || ' compile';
??????? begin
??????????? execute immediate str_sql;
??????? exception
????????? --When Others Then Null;
??????????? when OTHERS Then
????dbms_output.put_line(sqlerrm);
??????? end;
??? end loop;?
end;