oracle传统分页查询主要有如下三种:
1.根据ROWID来分
select * from t_xiaoxi where rowid in (select rid from (select
rownum rn,rid from (select rowid rid,cid from
t_xiaoxi order by cid desc) where rownum<10000)
where rn>9980) order by cid desc;
2.select * from (select t.*,row_number() over (order by cid
desc) rk from t_xiaoxi t) where rk<10000 and
rk>9980;
3.按ROWNUM来分
select * from (select t.*,rownum rn from (select * from t_xiaoxi
order by cid desc) t where rownum<10000) where
rn>9980;
以下是测试通过的分页查询例子:
select * from (select al.*,rownum rn from (select ename,job from
emp) a1 where rownum<=10) where
rn>=5;