Entry
How to split the result into pages, like 'limits' in MySQL? (PHP4+Oracle 8i)
Jan 20th, 2001 19:01
Alistair McElligott, Petr Kocian, Wenjun Shen,
You have to use subselect. The inner query selects all records and
every record will get its number rn. The outter query then selects just
required interval of records.
to select records from 51 to 100 use condition like this:
SELECT * FROM
(SELECT some_fields, ROWNUM rn FROM some_table)
WHERE rn BETWEEN 51 AND 100
Important is to use alias of the ROWNUM field in the inner query.
This sollution is a little uneffective because the inner query will
select all records.
This approach doesn't work if you have an order-by clause, as the
ordering (on the subquery) is performed _AFTER_ the row numbers are
allocated.