title: dynamic columns in oracle using sql
body: <p>I have following example of table. Thera can be unlimited branch and customers. I need group this branches and count their customers, then show it's with different columns.</p>
  
  <pre><code>BRANCHNAME  CUSTOMERNO
  100         1001010
  100         1001011
  103         1001012
  104         1001013
  104         1001014
  104         1001015
  105         1001016
  105         1001017
  106         1001018
  </code></pre>
  
  <p>Note that there can be unlimited branch and customers, the query must work not only this case.</p>
  
  <p>In this case the accepted result is:</p>
  
  <pre><code>100 103 104 105 106
   2   1   3   2   1
  </code></pre>
  
  <p>Example SQL DATA</p>
  
  <pre><code>    select '100' BranchName,'1001010' CustomerNo from dual   UNION ALL 
      select '100' BranchName,'1001011' CustomerNo from dual   UNION ALL 
      select '103' BranchName,'1001012' CustomerNo from dual   UNION ALL 
      select '104' BranchName,'1001013' CustomerNo from dual   UNION ALL 
      select '104' BranchName,'1001014' CustomerNo from dual   UNION ALL 
      select '104' BranchName,'1001015' CustomerNo from dual   UNION ALL 
      select '105' BranchName,'1001016' CustomerNo from dual   UNION ALL 
      select '105' BranchName,'1001017' CustomerNo from dual   UNION ALL 
      select '106' BranchName,'1001018' CustomerNo from dual   
  </code></pre>