oracle 优化or 更换in、exists、union几个字眼。测试没有问题!

根据实际情况选择相应的语句是。假设指数,or全表扫描,in 和not in 应慎用。否则会导致全表扫描。

 select *
   from T_Pro_Product
  where bar_code = 'nnnmmm'
     or name = 'nnnmmm'
     or no = 'nnnmmm'; select *
from T_Pro_Product
where 'nnnmmm' in (bar_code, name, no) --忧化
select *
from T_Pro_Product t1
where exists
(select 1
from T_Pro_Product tt1
where t1.bar_code = 'nnnmmm'
union all
select 1
from T_Pro_Product tt2
where t1.no = 'nnnmmm'
union all
select 1 from T_Pro_Product tt3 where t1.name like 'n%') --忧化
select *
from T_Pro_Product t1
where t1.id in (select id
from T_Pro_Product tt1
where t1.bar_code = 'nnnmmm'
union all
select id
from T_Pro_Product tt2
where t1.no = 'nnnmmm'
union all
select id
from T_Pro_Product tt3
where t1.name = 'nnnmmm')

最新文章

  1. Javascript 知识点整理
  2. CentOS6.5安装telnet命令
  3. 在SSIS 2012中使用CDC(数据变更捕获)
  4. Win10微软官方最终正式版ISO镜像文件
  5. docker入门的文章
  6. Linux守护进程详解(init.d和xinetd) [转]
  7. PHP包含文件函数include、include_once、require、require_once区别总结
  8. Android笔记——Bitmap自动取色(纯搬运)
  9. Android Service即四大组件总结
  10. android中选择控件与选择界面自然过度效果的实现--一种新的交互设计
  11. Multiple
  12. hdu1151Air Raid
  13. JQuery Smart UI
  14. FAIR开源Detectron:整合全部顶尖目标检测算法
  15. Android项目实战(四十七):轮播图效果Viewpager
  16. Leetcode:0002(两数之和)
  17. python-mongodb基本操作都在这了
  18. mybatis JdbcTypeInterceptor - 运行时自动添加 jdbcType 属性
  19. 用自定义的RoundImageView来实现圆形图片(可加边框)
  20. CodeForces - 779D String Game 常规二分

热门文章

  1. PageHeap,调试Heap问题的工具
  2. [C++]Hello C++
  3. poj 3270 更换使用
  4. Perl语言学习笔记 9 正则表达式处理文本
  5. Application to find the maximum temperature in the weather dataset
  6. WebService 通过POST方式访问时候,因 URL 意外地以“/方法名”结束,请求格式无法识别 解决办法
  7. Cocos2dx项目启程二 之 封装属于我的按钮类
  8. CCLuaObjcBridge调Objective-C方法传索引数组报invalid key to 'next'错调试
  9. 【LeetCode】Reorder List 解题报告
  10. H3C TE BGP拓扑排错报告