title: Get XMLType from a cursor
body: <p>Anyone knows if I can generate a XMLType from a cursor without having to specify each row's name manually ?</p>
  
  <p>I would like to be able to loop over my query, and to get a separate XML for each row.</p>
  
  <p>I couldn't get a solution using DBMS_XMLGEN.getXMLType, but perhaps I didn't use it properly.</p>
  
  <pre><code>CREATE OR REPLACE PROCEDURE "MY_SCHEMA"."TEST" AS
  
  CURSOR mySelectCursor is
      SELECT '1a' as "column1", '1b' as "column2" FROM DUAL
      UNION ALL
      SELECT '2a' as "column1", '2b' as "column2" FROM DUAL;
  
  myXMLType XMLType;
  BEGIN
  
  FOR mySelect in mySelectCursor
      LOOP
          -- I would like to replace the following line of code
          myXMLType := XMLType('&lt;row&gt;&lt;column1&gt;' || mySelect."column1" || '&lt;/column1&gt;&lt;column2&gt;' || mySelect."column2" || '&lt;/column2&gt;&lt;/row&gt;');
          -- by something similar to this (not working) one
          --myXMLType := mySelect.getXMLType();
          dbms_output.put_line(myXMLType.getClobVal());
      END LOOP;
  END;
  
  --The following code outputs
  --&lt;row&gt;&lt;column1&gt;1a&lt;/column1&gt;&lt;column2&gt;1b&lt;/column2&gt;&lt;/row&gt;
  --&lt;row&gt;&lt;column1&gt;2a&lt;/column1&gt;&lt;column2&gt;2b&lt;/column2&gt;&lt;/row&gt;
  </code></pre>