ROWNUM Column

For each row returned by a query, ROWNUM returns a number indicating the order in which Oracle RDBMS selects the row from a table or set of joined rows.

The general format is:

ROWNUM

Example 1:

SELECT * FROM invoice WHERE ROWNUM < 10;

returns first 9 rows

Example 2:

SELECT * FROM invoice WHERE ROWNUM > 1;

this query returns no rows

If an ORDER BY clause follows ROWNUM in the same query, the results can vary depending on the way the rows are accessed.