查询编译不通过的存储过程并重新编译

declare

cursor proce is Select Object_Name,owner,object_type From All_Objects Where Status = 'INVANID' and 
(Object_type = 'PROCEDURE' or lower(Object_type) = 'function');

Strsql Varchar2(200);

BEGIN    
    for i in proce loop
        Strsql:= 'Alter '||i.object_type||' '||i.owner||'.'||i.Object_name||' Compile';
        Begin
            Excute Immediate Strsql;
            Exception
            -- When others then Null;
            when others THEN
            dbms_output.put_line(i.owner||'.'||i.Object_name||'---'||Sqlerrm);
        end;
    end loop;
END;

 

posted @ 2017-12-13 00:07  雅虎跳跳  阅读(381)  评论(0编辑  收藏  举报