Using Oracle SQL `offset fetch next rows only` for pagination

If you are using Oracle SQL offset :number fetch next :number rows only , you must know that offset does not represent page number.

If you are trying to use it as page number, here is formula:

offset : ( rowLimitPerPage * pageNumber ) - rowLimitPerPage 

In tech term, the OFFSET clause specifies the number of rows to skip before starting to return rows from the query.

In simple term, the OFFSET clause is the starting point of row number, it is a variable to specific from which row you are going to query up to which row FETCH NEXT .

Read more at https://www.sqlservertutorial.net/sql-server-basics/sql-server-offset-fetch/

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Cing Sian Dal

Don’t follow me. I wrote junks here. Follow me on Twitter instead.