当前位置:数据库 > Oracle >>

oracle分页

oracle分页
 
1)rownum分页(由oracle分配)慢十倍
  www.zzzyk.com  
    1.(select a1.*,rownum rn from (select * from emp) a1 where rownum<=10);
 
    2.select * from (select a1.*,rownum rn from (select * from emp) a1 where rownum<=10) where rn>=6;
 
    3.select * from (select a1.*,rownum rn from (select name,address from emp) a1 where rownum<=10) where rn>=6;//只需修改最里层字段即可限制
 
2)ROWID来分最快!  www.zzzyk.com  
 
select * from t_xiaoxi where ROWID in (select rid from(select     rownum rn,rid from(select rowid rid ,cid from t_xiaoxi order by cid desc) where rownum<1000) where rn>500) order by cid desc;
 
3)函数(over)慢100倍
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,