oracle使用rownum可以实现分页的功能。
oracle对外提供的自动给查询结果编号的rownum关键字,与每行的数据没有关系。
--注意:rownum关键字只能做< <=的判断,不能进行> >=的判断
现有一个数据表aa
--1到2
select e.*
from (select rownum r, aa.* from aa where rownum<=9 order by aa.编号) e
where e.r<=2
--3到4
select e.*
from (select rownum r, aa.* from aa where rownum<=4 order by aa.编号) e
where e.r>=3
--5到6
select e.*
from (select rownum r, aa.* from aa where rownum<=6 order by aa.编号) e
where e.r>=5