MySQL LIMIT 1,10 clause equivalent in ORACLE
Thursday, June 7, 2012 at 7:30 PM | Labels: MySQL, ORACLE, ROWNUMROWNUM is a pseudo-column that returns a row's position in a result set.
ROWNUM is evaluated AFTER records are selected from the database and BEFORE the execution of ORDER BY clause.
The following type of queries will ALWAYS return NO DATA:
... WHERE ROWNUM > x ... WHERE ROWNUM BETWEEN x AND y ... WHERE ROWNUM IN (x, y, z, ...)
However, this will work:
... WHERE ROWNUM < x
SELECT EMPNAME FROM
(SELECT EMPNAME, ROWNUM R FROM employees)
WHERE R BETWEEN 51 and 100;
Thus, if you want the next 10 results,
However, this will work:
select
*
from
(
select
t.*, ROWNUM
r
from
table
t)
where
r
between
101
and
120;
Subscribe to:
Posts (Atom)