zoukankan      html  css  js  c++  java
  • 如何自动批量编译存储过程

    1.批量编译存储工程的存储过程

    create or replace procedure compile_invalid_procedures(
        p_owner varchar2 -- 所有者名称,即 SCHEMA
    ) as

    --编译某个用户下的无效存储过程

        str_sql varchar2(200);

    begin
        for invalid_procedures in (select object_name from all_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;
    2.批量编译视图的存储过程

    create or replace procedure compile_invalid_views(
        p_owner varchar2 -- 所有者名称,即 SCHEMA
    ) as

    --编译某个用户下的无效存储过程

        str_sql varchar2(200);

    begin
        for invalid_views in (select object_name from all_objects
           where status = 'INVALID' and object_type = 'VIEW' and owner=upper(p_owner))
        loop
            str_sql := 'alter view ' ||invalid_views.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;

    3.创建JOB,调度批量编绎存储过程

  • 相关阅读:
    spring注解方式AOP
    struts2 值栈的理解
    JAVA自定义注解
    JS学习随笔。
    使用Jsoup解析html网页
    Struts迭代器(iterator)遍历List常用的4种例子
    Maven 结合 Spring profile对不同的部署环境打包部署
    打印插件LODOP使用介绍
    Linux下查看CPU信息、机器型号等硬件信息
    验证码的生成和验证
  • 原文地址:https://www.cnblogs.com/HondaHsu/p/2680451.html
Copyright © 2011-2022 走看看