oracle使用rownum分页

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

oracle使用rownum分页

2021-12-11

© 版权声明
THE END
如果内容对您有所帮助,就支持一下吧!
点赞0 分享
我一上班就想吐的头像 - 鹿快
评论 抢沙发

请登录后发表评论

    暂无评论内容