文章詳情頁
oracle 數據分頁查詢
瀏覽:50日期:2023-11-14 15:37:01
1. 最好還是利用分析函數row_number() over ( partition by col1 order by col2 )比如想取出100-150條記錄,按照tname排序select tname,taBType from ( select tname,tabtype,row_number() over ( order by tname ) rn from tab)where rn between 100 and 150;2. 直接使用rownum 虛列select tname,tabtype from ( select tname,tabtype,rownum rn from tab where rownum <= 150)where rn >= 100;使用序列不能基于整個記錄集合進行排序,假如指定了order by子句,排序的的是選出來的記錄集的排序.------------------------------------------------------------------------經過我的測試,在100萬條數據的表中,檢索數據的時候,方法2的速度要比方法1要快的.
排行榜