We can't use ROWNUM in a query with greater than condition.
For Example, we have below queries.
SELECT * FROM EMPTABLE WHERE ROWNUM > 100
output: 0 rows returned.
SELECT * FROM EMPTABLE WHERE ROWNUM < 100
output: it returns all 100 rows.
It is because rownum is a dymanic number generated and assigned to the rows while fetching the data from database. which is something like counting from 1,2..... It can't read which is 100th row unless it knows previous rows starting from 1. Hence it doesn't work with greater than (>) condition.
For Example, we have below queries.
SELECT * FROM EMPTABLE WHERE ROWNUM > 100
output: 0 rows returned.
SELECT * FROM EMPTABLE WHERE ROWNUM < 100
output: it returns all 100 rows.
It is because rownum is a dymanic number generated and assigned to the rows while fetching the data from database. which is something like counting from 1,2..... It can't read which is 100th row unless it knows previous rows starting from 1. Hence it doesn't work with greater than (>) condition.
No comments:
Post a Comment