oracle分頁查詢

2021-08-08 17:11:00 字數 427 閱讀 2530

oracle分頁不像mysql和sqlserver那麼簡單,mysql有limit函式可以實現分頁,sqlserver有top關鍵字可以分頁,oracle沒有類似函式或關鍵字,必須借助偽列rownum

總體思路是,從第幾行開始查詢,要查詢多少頁,分頁查詢語句如下:

每頁顯示10條分頁

select * from(

select rownum rm, t.*  from t_user t

) tm where rm > 10 and rm <= 20

換成**形式

select * from(

select rownum rm, t.*  from t_user t

) tm where rm > pagesize * ( pagenow - 1 ) and rm <= pagesize * pagenow

ORACLE分頁查詢

單錶分頁 start num 起始行號 end num 截止行號 select t.from select s.rownum rn from table s where rownum end num t where rn start num 多表分頁 select from select temp....

Oracle分頁查詢

oracle的分頁查詢語句基本上可以按照本文給出的格式來進行套用。分頁查詢格式 select from select a.rownum rn from select from table name a where rownum 40 where rn 21 其中最內層的查詢select from t...

oracle 分頁查詢

1 要把rowid來分 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 r...