方法一:
select * from?
?????? (select rownum as my_rownum,a.* from?my_table? where rownum<20000)
where my_rownum>=10000
方法二:
select * from my_tablewhere rownum<=20000 minus (select * from my_table where rownum<10000)
相比较而言,方法一的效率要高的多。
方法一的改进:
去掉my_rownum字段
select c.* from?
?????? (select rownum as my_rownum,a.* from? my_table? a? where rownum<20000) b ,my_table? c
where my_rownum>=15000 and c.id = b.id;

博客介绍了两种Oracle SQL的分页查询方法,方法一是嵌套查询,方法二使用minus操作。经比较,方法一效率更高。此外,还给出了方法一的改进方案,即去掉my_rownum字段并通过关联查询优化。
31万+

被折叠的 条评论
为什么被折叠?



