title: How to do Pivoting in Oracle 10g
body: <p>Consider the following</p>
  
  <p><strong>Sample Input</strong></p>
  
  <pre><code>SalesBoyName        Product       Amount
  ------------        -------       ------
  Boy1                P1               100
  Boy1                P1                40
  Boy1                P2               100
  Boy2                P1               100
  Boy2                P3                12
  </code></pre>
  
  <p><strong>Desired Output</strong></p>
  
  <pre><code>SalesBoyName     P1     P2     P3
  ------------   ----   ----   ----
  Boy1            140    100   null
  Boy2            100   null     12
  </code></pre>
  
  <p>The below SQL SERVER 2005 query will do the work</p>
  
  <pre><code>SELECT SalesBoyName, [P1] AS P1, [P2] AS P2,[P3] AS P3
  FROM 
  (SELECT * FROM tblSales ) s
  PIVOT
  (
  SUM (Amount)
  FOR Product IN
  ( [P1], [P2], [P3])
  ) AS pvt    
  </code></pre>
  
  <p>I want to perform the same thing in Oracle 10g.</p>
  
  <p>How to do this?</p>
  
  <p>This may be trivial, but since i am very new to Oracle, so I am seeking for help.</p>
  
  <p>Thanks</p>