Oracle Conditional sum
SQL&gt; r
  1  with t as (
  2      select  1.0 as x from dual
  3      union all select -2.0 as x from dual
  4      union all select  3.0 as x from dual
  5      union all select -4.0 as x from dual
  6      union all select  5.0 as x from dual
  7      union all select -6.7 as x from dual
  8      union all select  8.9 as x from dual)
  9  select sum(case when x &gt; 0 then x else 0 end) as sum_of_positives,
 10         sum(case when x &lt; 0 then x else 0 end) as sum_of_negatives
 11*   from t

SUM_OF_POSITIVES SUM_OF_NEGATIVES
---------------- ----------------
            17,9            -12,7