title: Select over a subquery having WITH clause
body: <p>I'm not familiar to DB2 and in Oracle we can do the following</p>
  
  <pre><code>select * from 
  (WITH A AS (SELECT 'test' FROM DUAL)
   SELECT *
    FROM A )
  </code></pre>
  
  <p>I have a requirement to so similar to this in DB2, but it wont allow me. My requirement is not exactly same as above, but i simplified.</p>
  
  <p>There is another issue, I'm trying to do a XML output on a results got using my below query. But the issue is when I call the <code>XMLFOREST</code> function, it restricts me to have only a column as input (in the example below example, <code>A*B</code> it does not allow).</p>
  
  <pre><code>SELECT XMLELEMENT (
        NAME "DATA",
        XMLAGG (XMLELEMENT (NAME "DJ_STOCK", (XMLFOREST (A, B, A * B)))))
  FROM (SELECT *
        FROM (SELECT RTRIM (RTRIM (6.0000), '.') A,
                     RTRIM (RTRIM (6.0000), '.') B
                FROM SYSIBM.SYSDUMMY1))
  </code></pre>
  
  <p>I could do <code>A*B</code> in the inner query and call it as <code>C</code> and then call from the <code>xmlforest</code> function, but my actual scenario does not allow me to do that due to performance. Any workaround?</p>
  
  <p>I'm using DB2 9.5 version</p>