--没有order by写法
SELECT *
FROM (SELECT ROWNUM AS rowno, t.*
FROM DONORINFO t
WHERE t.BIRTHDAY BETWEEN TO_DATE ('19800101', 'yyyymmdd')
AND TO_DATE ('20060731', 'yyyymmdd')
AND ROWNUM <= page*size) table_alias
WHERE table_alias.rowno > (page-1)*size;
--实例
SELECT *
FROM (SELECT ROWNUM AS rowno, t.*
FROM testuser t
WHERE t.sclass = 95033
AND ROWNUM <= 5*6) table_alias
WHERE table_alias.rowno > (5-1)*6;
--有order by 排序
--规范实例
SELECT * FROM (
SELECT ROWNUM AS rowno,r.* FROM(
SELECT * FROM testuser t
WHERE t.sclass = 95033
ORDER BY t.sno desc
) r
where ROWNUM <= page*size
) table_alias
WHERE table_alias.rowno > (page-1)*size;
--示例
SELECT * FROM (
SELECT ROWNUM AS rowno,r.* FROM(
SELECT * FROM testuser t
WHERE t.sclass = 95033
ORDER BY t.sno desc -- 想要正序去掉desc
) r
where ROWNUM <= 2*3
) table_alias
WHERE table_alias.rowno > (2-1)*3;
--表在我博客中有