title: How do I limit the number of rows returned by an Oracle query after ordering?
body: <p>Is there a way to make an <code>Oracle</code> query behave like it contains a MySQL <code>limit</code> clause?</p>
  <p>In MySQL, I can do this:</p>
  <pre><code>select * 
  from sometable
  order by name
  limit 20,10
  </code></pre>
  <p>to get the 21st to the 30th rows (skip the first 20, give the next 10). The rows are selected after the <code>order by</code>, so it really starts on the 20th name alphabetically.</p>
  <p>In Oracle, the only thing people mention is the <code>rownum</code> pseudo-column, but it is evaluated <em>before</em> <code>order by</code>, which means this:</p>
  <pre><code>select * 
  from sometable
  where rownum &lt;= 10
  order by name
  </code></pre>
  <p>will return a random set of ten rows ordered by name, which is not usually what I want. It also doesn't allow for specifying an offset.</p>