您好,欢迎来到九壹网。
搜索
您的当前位置:首页oracle PLSQL 多结果集嵌套循环处理优化

oracle PLSQL 多结果集嵌套循环处理优化

来源:九壹网

 

 oracle多结果集嵌套循环处理优化

--性能差
begin
 for a in (select id,name,sex,idcard from people) loop
    for b in (select id,name,sex,idcard from english) loop
       if a.idcard = b.idcard then
       --do something
       end if;
    end loop;
 end loop;
end;

--性能优:将多表合并成一个结果集,避免嵌套循环
begin
 for a in (select p.id,p.name,p.sex,p.idcard from people p,english e where p.idcard = e.idcard) loop
       --do something
 end loop;
end;

 

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- 91gzw.com 版权所有 湘ICP备2023023988号-2

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务