一般情况对于有主键,能够做唯一表识的表,我们可以利用主键和rownum配合实现,例如:
select scott.emp.*
from scott.emp left join
(select empno id, rownum num from scott.emp) id_num
on scott.emp.empno = id_num.id
where id_num.num between 5 and 10;
如果遇到没有主键的表可以尝试rowid代替,rowid不会因为排序或者查询,甚至update都不会修改,因此可以借助这个字段作分页。
select scott.emp.*
from scott.emp left join
(select rowid id, rownum num from scott.emp) id_num
on scott.emp.rowid = id_num.id
where id_num.num between 5 and 10;
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文地址:http://blog.csdn.net/he_qiao/article/details/47012515