SQL 语句优化 案例1
2009-09-29 09:26
274 查看
select count(1)
2 into l_line_num --l_number_of_day
3 from hek_om_pop_validity_all
4 where inventory_item_id = l_item_id
5 and ((start_date <= sysdate
6 and end_date >= sysdate)
7 or (start_date <= sysdate and end_date is null));
修改后:
select count(1)
2 into l_line_num --l_number_of_day
3 from hek_om_pop_validity_all
4 where inventory_item_id = l_item_id
5 and start_date <= sysdate
6 and nvl(end_date, sysdate + 1) >= sysdate;
2 into l_line_num --l_number_of_day
3 from hek_om_pop_validity_all
4 where inventory_item_id = l_item_id
5 and ((start_date <= sysdate
6 and end_date >= sysdate)
7 or (start_date <= sysdate and end_date is null));
修改后:
select count(1)
2 into l_line_num --l_number_of_day
3 from hek_om_pop_validity_all
4 where inventory_item_id = l_item_id
5 and start_date <= sysdate
6 and nvl(end_date, sysdate + 1) >= sysdate;
相关文章推荐
- SQL语句常见优化十大案例
- 经典案例:如何优化Oracle使用DBlink的SQL语句
- SQL 语句优化--OR 语句优化案例
- mysql sql语句优化案例 依靠主要性能指标来判断
- SQL 语句优化--IN语句优化案例
- SQL 语句优化--IN语句优化案例
- 典型的SQL语句优化案例
- SQL 语句优化--IN语句优化案例
- SQL 语句优化--OR 语句优化案例
- Sql语句优化之explan分析案例
- 性能优化分析案例---解决SQL语句过度消耗CPU问题
- 数据库性能优化分析案例---解决SQL语句过度消耗CPU问题
- SQL语句常见优化十大案例
- Oracle中SQL语句的性能优化
- 基于索引的SQL语句优化之降龙十八掌
- sql语句优化
- Sql 语句优化与执行顺序
- oracle分页sql优化语句
- 基于索引的SQL语句优化之一
- MySQl优化千万数据级快速分页sql语句