oracle分页???
在mysql中只要limit x,y就可以分页成功,那oracle 中是怎么做的呢?
=================================================
方法一:
SELECT id,rown
FROM (SELECT id, ROWNUM rown
FROM (SELECT id
FROM table
WHERE (************)
ORDER BY ********)
WHERE ROWNUM <= 每页条数*页号)
WHERE (rown BETWEEN 每页条数*页号-(每页条数-1) AND 每页条数*页号)
搞不定和我联系 [email protected]
这样取出第11-20条记录!
select * from (
select rownum r,a from yourtable
where rownum <= 20
order by name )
where r > 10
=========================================================
[code=SQL]
select * from
(select rownum r , e.*
--根据条件查找出所要的记录
from
(select * from empwhere 条件 order by 字段 ) e
)
where r between 起始行and 结束行
[/code]
======================================================
方法三:
a_ja(青藏牦牛)回复于 2003-06-14 12:16:29 得分 0
select * from you_db_table where rownum < 20
minus
select * from you_db_table where rownum < 10
这样取出的是10~20之间的记录
======================================================
方法四:
有分页相对应的函数,如果从oracle中第100条开始,取10条数据,可以这样写:
Query q=session.creatQuery(" fromPerson as p");
q.setFirstResult(100);
q.setMaxResult(10);
List l=q.list();