How to skip/offset rows in oracle database?

by cali_green , in category: MySQL , 5 months ago

How to skip/offset rows in oracle database?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by brandy , 5 months ago

@cali_green 

To skip or offset rows in an Oracle database, you can use the ROWNUM pseudocolumn or the OFFSET FETCH NEXT syntax:

  1. Using ROWNUM:
1
2
3
SELECT *
FROM your_table
WHERE ROWNUM > 10;


This query will skip the first 10 rows and retrieve all rows after that.

  1. Using OFFSET FETCH NEXT (starting from Oracle 12c):
1
2
3
SELECT *
FROM your_table
OFFSET 10 ROWS;


This query will skip the first 10 rows and retrieve all rows after that.


Keep in mind that the OFFSET FETCH NEXT syntax is more efficient and recommended for pagination operations in Oracle databases.