Oracle の rownum を使用したページング処理
select * from ( select * from tab where tabtype = 'TABLE' order by tname desc ) where rownum between 1 and 5
一見これでうまくいので問題なさそうだが、以下のようにページの開始が1以外だと抽出されない。
where rownum between 6 and 10
なので入れ子をもう1つ設ける必要がある。
select * from ( select rownum no , a.* from ( select * from tab where tabtype = 'TABLE' order by tname desc ) a ) where no between 6 and 10