HOW does ROWNUM work with this "optimization"
The rownum pseudocolumn is assigned as rows are processed.  The predicate rownum = &lt;&lt;x&gt;&gt; will evaluate to false if &lt;&lt;x&gt;&gt; is anything other than 1.

Conceptually (and I emphasize that this isn't how Oracle actually works, it's just a useful abstraction), the second query does something like


Read a row from table1 
Evaluate the col2 = 'val' expression  
If col2 = 'val', evaluate the extract 
Assign the rownum to the row that has been returned.  Since no other rows have satisfied all the criteria yet, the rownum will be 1 
Evaluate the rownum = &lt;&lt;x&gt;&gt; predicate. If &lt;&lt;x&gt;&gt; is anything other than 1, the row is
rejected
Go back to step 1 and read the next row


In this loop, every row will be read from table1.  And every row will be rejected (assuming &lt;&lt;x&gt;&gt; is something other than 1) because of the rownum = &lt;&lt;x&gt;&gt; predicate.  So you'll incur the cost of reading every row from the table, evaluating the extract for every row, and you'll never return any data.

Your first query appears to be working because it is filtering out &lt;&lt;x&gt;&gt; + 1 rows in the subquery.  Of course, since there is no ORDER BY, your first query always returns an arbitrary row.  It would be entirely legal for Oracle to return the same row for every value of &lt;&lt;x&gt;&gt; in your first query.  It probably won't, of course, but it is entirely possible that you'd get different rows over time, that some rows would never be returned, that other rows would be returned multiple times, etc.  If you want a deterministic result (prior to 12.1 which has some simpler syntax options), you'd need to do two levels of nesting

SELECT *
  FROM (SELECT b.*,
               rownum rn
          FROM (SELECT a.*
                  FROM some_table a
                 ORDER BY some_column) b
         WHERE rownum &lt;= &lt;&lt;upper_limit&gt;&gt;) c
 WHERE rn &gt;= &lt;&lt;lower_limit&gt;&gt;


For a pretty thorough discussion of the various issues, take a look through this askTom thread.