Database rows in general do not have a defined order. Unless you use order by, the database is free to return rows in any order it wants. Sometimes this order corresponds to the order in which rows are physically stored in the table, but it is never guaranteed. See also our FAQ page on Order by.
Specifically for Oracle's rownum, just adding the ORDER BY is not enough. Rownums are assigned and the where condition is evaluated before the rows are sorted. This is somewhat counter-intuitive, but that's life . So, in Oracle, you always need to use nested queries with rownum. In your case, it would be: