title: Transpose select results with Oracle
body: <p>my question is, with some background:</p>
  
  <p>I have to generate some sql queries based on the table metadata (column format), and the result is something like:</p>
  
  <pre><code>TABLENAME1|COL1
  TABLENAME1|COL2
  TABLENAME2|COL1
  TABLENAME2|COL2
  TABLENAME2|COL3
  TABLENAME3|COL1
  TABLENAME4|COL1
  TABLENAME4|COL2
  ... /*some other 1800 rows */
  </code></pre>
  
  <p>(Yeah, it's ordered.)
  What I need is to transpose this data, based on the first column, so the expected output would be:</p>
  
  <pre><code>TABLENAME1|COL1|COL2|NULL
  TABLENAME2|COL1|COL2|COL3
  TABLENAME3|COL1|NULL|NULL
  TABLENAME4|COL1|COL2|NULL
  /* less then 1800 rows ;-) */
  </code></pre>
  
  <p>Is it possible using Oracle SQL?</p>
  
  <p>Thanks in advance!</p>