title: PL-SQL: getting column data types out of query results
body: <p>Trying to make a generic PL/SQL procedure to export data in specific XML format, e.g. Excel XML. Let's say the procedure accepts a string with the SELECT query to EXECUTE IMMEDIATE. </p>
  
  <p>This requires access to data types of each column of the resulting rowset, which -- seeing as the procedure is to be generic -- is only known after the query is run.</p>
  
  <p>I have tried an approach with a temporary table, but for the procedure to compile the table must exist and have its structure known at compile time.</p>
  
  <p>How can I next process the rows and columns of an EXECUTE IMMEDIATE result in a double loop that analyzes the type of each value and emits an appropriate piece of XML?</p>