数据库
首页 > 数据库> > Oracle分页查询

Oracle分页查询

作者:互联网

Oracle的分页查询实现,采用ROWNUM。

格式1(推荐)

SELECT * FROM

(

SELECT temp.*, ROWNUM RN

FROM (SELECT * FROM 表名) temp

WHERE ROWNUM <=end (page*pagesize)

)

WHERE RN >=start (page-1*pagesize+1)

格式2

SELECT * FROM

(

SELECT temp.*, ROWNUM RN

FROM (SELECT * FROM TABLE_NAME) temp

)

WHERE RN BETWEEN start (page-1*pagesize+1) AND end (page*pagesize) ​

标签:分页,temp,查询,pagesize,Oracle,ROWNUM,RN,SELECT,page
来源: https://www.cnblogs.com/xiaoguo876/p/16694113.html