Using Oracle SQL `offset fetch next rows only` for pagination
Jun 14, 2021
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/