【备忘】oracle的sql分页

oracle分页的sql语句,分排序和不排序两种。

一、不排序

 

select * from(
    select rownum r,  field1,field2 from table_name 
        where rownum <= currentPage * rowPerPage
) 
where r > (currentPage-1) * rowPerPage 
 

 

 

二、排序

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<10000)
 where rn>9980) 
order by cid desc;

你可能感兴趣的:(oracle)