This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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: