How to use jdbi oracle paging

156 views
Skip to first unread message

吕兵阳

unread,
Mar 21, 2018, 8:51:09 PM3/21/18
to jDBI

@stevenschlansker
How to use jdbi with oracle paging,such as

SELECT * FROM
(
SELECT A.*, ROWNUM RN
FROM (SELECT * FROM TABLE_NAME) A
WHERE ROWNUM <= 40
)
WHERE RN >= 21

Matthew Hall

unread,
Mar 21, 2018, 8:53:21 PM3/21/18
to jd...@googlegroups.com
Have you looked through our developer guide at jdbi.org?

-Matthew



--
You received this message because you are subscribed to the Google Groups "jDBI" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jdbi+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

吕兵阳

unread,
Mar 21, 2018, 9:14:40 PM3/21/18
to jDBI
Yes, I have read your development guide, but have not found anything related to paging.
Can you give me a specific paging guide where
在 2018年3月22日星期四 UTC+8上午8:51:09,吕兵阳写道:

Matthew Hall

unread,
Mar 22, 2018, 3:58:05 PM3/22/18
to jd...@googlegroups.com
There are two main schools of thought on paging:
  • Use OFFSET and LIMIT clauses return a window of rows (or use ROWNUM as in your example) within a large dataset.
  • Use WHERE to only return rows after the previous page, then LIMIT the number of rows. (jOOQ calls this "seek")
The jOOQ folks have a great blog post on how to structure your SQL for pagination:

https://blog.jooq.org/2013/10/26/faster-sql-paging-with-jooq-using-the-seek-method/

Hope this helps,

-Matthew

--
Reply all
Reply to author
Forward
0 new messages