优秀的编程知识分享平台

网站首页 > 技术文章 正文

oracle使用rownum分页(oracle分页的几种方式)

nanyue 2025-07-01 22:19:59 技术文章 1 ℃

oracle使用rownum分页

rownum行号:当我们做select操作时,每查询出的一条记录,就会在该行记录上加上一个行号,行号从一开始,不能跳着走,

排序操作会影响rownum的顺序

rownum不能写上大于一个整数,(rownum>4--错误)


例如,每页10条,查询第二页

select * 
from
(
	select a.*,rownum rn
	from
	(
		select * 
		from parm_table_basic_check
		order by table_name,column_name
	) a
	where rownum<=20
) b 
where b.rn>=11

----other

with temp1 as
(
     select * 
     from parm_table_basic_check
     order by table_name,column_name
)
select * 
from
(
  select temp1.*,rownum rn
  from temp1
  where rownum<=20
) b 
where b.rn>=11

2021-12-11

Tags:

最近发表
标签列表