I have the following SQL query:
select
ID, COLUMN1, COLUMN2
from
(select ID, COLUMN1, COLUMN2, row_number() over (order by 2 DESC) NO from A_TABLE)
whe
rownum is a pseudo column that counts rows in the result set after the where clause has been applied.
Is this what you're trying to get?
SELECT *
FROM (
SELECT id, column1, column2
FROM atable ORDER BY 2 DESC
)
WHERE ROWNUM < 100;
Because it's a pseudo column that is strictly a counter of rows resulting from the where clause it will not allow you to do pagination (i.e. between 200 & 300).
This is probably what you're looking for:
SELECT *
FROM
(SELECT a.*, rownum rnum FROM
(SELECT id, column1, column2 FROM atable ORDER BY 2 DESC) a WHERE rownum <= 300)
WHERE rnum >= 200;