title: Row data multiplication in Oracle
body: <p>Consider following table where I am doing row data multiplication:</p>
  
  <pre><code>with v1 (member_id, the_number) as 
  (
  select 1, 3 from dual union all
  select 1, 5 from dual union all
  select 2, 2 from dual union all
  select 2, 3 from dual union all
  select 2, 4 from dual union all
  select 3, 9 from dual union all
  select 3, 3 from dual union all
  select 3, 2 from dual
  )
  select member_id, EXP(SUM(LN(the_number))) from v1
  GROUP BY member_id; 
  </code></pre>
  
  <p>It gives the correct result as:</p>
  
  <pre><code>MEMBER_ID   EXP(SUM(LN(THE_NUMBER)))
  1           15
  2           24
  3           54
  </code></pre>
  
  <p>The moment I put a negative value in the <code>the_number</code> column, I get the following Oracle error: <code>ORA-01428: argument 'x' is out of range</code> This is because the range for <code>LN ()</code> argument is > 0.</p>
  
  <p>How can I modify the query so that I can have negative values as well in <code>the_number</code> column? I am using <code>Oracle 11g</code>.</p>