Unexpected results in query with rownum condition
The pseudocolumn rownum is assigned AFTER all the result rows from the query are retrieved, and so the correct way using rownum to get say 10 rows, is to use &lt;= as pointed out in the comments.  The rownum can never be greater than the number of rows returned.  Example:

SYS@ecs03&gt; select table_name from dba_tables where rownum &lt;= 10;

TABLE_NAME
--------------------------------
CCOL$
FILE$
CLU$
SEG$
ICOL$
OBJ$
TAB$
CON$
UNDO$
TS$

10 rows selected.

SYS@ecs03&gt;


And better yet as Kevin pointed out, use FETCH FIRST *n* ROWS clause, as you can add additional parameters to get deterministic results. 


  For consistent results, specify the order_by_clause to ensure a deterministic sort order.


That old code may have worked years ago, but not in the last several years. I got bit on an upgrade from Oracle 9i to 10c when we assumed that group by implied ORDER BY by the same columns in the group by clause.  Wrong!