title: Pivot on Oracle 10g
body: <p>I am using oracle 10g.
  I have a temp table TEMP.</p>
  
  <p>TEMP has following structure:-</p>
  
  <pre><code>USER COUNT TYPE
  ---- ----- ----
     1    10   T1
     2    21   T2
     3    45   T1
     1     7   T1
     2     1   T3
  </code></pre>
  
  <p>I need a query which will show all types has column names,and types can have any value like <code>T1, T2,..Tn</code> and result will be like:-</p>
  
  <pre><code>USER T1 T2 T3
  ---- -- -- --
     1 17  0  0
     2  0 21  1
     3 45  0  0
  </code></pre>
  
  <p>and User column will show all the users and <code>T1, T2</code> column will show total count of types.   </p>