title: Oracle LIMIT and 1000 column restriction
body: <p>I have a SQL query that looks like this:</p>
  
  <pre><code>SELECT foo "c0",
         bar "c1",
         baz "c2",
         ...
  FROM   some_table
  WHERE  ...
  </code></pre>
  
  <p>In order to apply a limit, and only return a subset of records from this query, I use the following wrapper SQL:</p>
  
  <pre><code>SELECT *
  FROM   (
      SELECT t.*,
             ROW_NUMBER() OVER (ORDER BY ...) rnum
      FROM   (
          ... original SQL goes here ...
      ) t
  )
  WHERE rnum BETWEEN 1 AND 10
  </code></pre>
  
  <p>My problem is that the original query is selecting over 1000 columns across a large number of joins to other tables.  Oracle has an internal limit of 1000 columns per table or view, and apparently the wrapper SQL I'm using to limit the result set is creating a temporary view to which this limit is applied, causing the whole thing to fail.</p>
  
  <p>Is there another method of pagination that doesn't create such a view, or wouldn't otherwise be affected by the 1000 column limit?</p>
  
  <p>I'm not interested in suggestions to break the work up into chunks, not select > 1000 columns, etc., as I'm already fully aware of all of these methods.</p>