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)
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/289559.html