OracleDB는 없는데 구글링해서 SQLite랑 Postgresql로 방법 찾아봄
테이블은
대충
id
text
is_hidden 세 개 필드로 구성했을 때
SQLite
WITH show_table AS (
SELECT row_number() over (order by _id) as `page_idx`, *
FROM table_name
WHERE _is_hidden = false ORDER BY _id ASC )
SELECT * FROM show_table WHERE page_idx BETWEEN 1 AND 10
PostgreSQL
WITH show_table AS (
SELECT row_number() over (order by _id) as "page_idx", *
FROM table_name
WHERE _is_hidden = false ORDER BY _id ASC )
SELECT * FROM show_table WHERE page_idx BETWEEN 1 AND 10
근데 이거 테이블 전체 순회할 것같은데, 차라리 뷰 쓰는 게 나아보이기도 하고...
버전상 offset안되니 본문대로하거나 다음 글에 언급된 set rowcount 정도가 아닐까 싶음.
성능관련 언급도 약간 있음
https://stackoverflow.com/questions/2308220/is-there-any-performance-issue-using-row-number-to-implement-table-paging-in-sql