For each row returned by a query, the ROWNUM pseudocolumn returns a number indicating the order in which Oracle selects the row from a table or set of joined rows. The first row selected has a ROWNUM of 1, the second has 2, and so on.
SELECT * FROM sometable1 so WHERE so.id IN ( SELECT so2.id from sometable2 so2 WHERE ROWNUM <=5 ) AND ORDER BY so.somefield AND ROWNUM <= 100
I have implemented this in oracle
server 11.2.0.1.0