title: Why SUM(null) is not 0 in Oracle?
body: <p>It would be appreciated explaining the internal functionality of SUM function in Oracle, when encountering null values: <br>
  The result of </p>
  
  <pre><code>select sum(null) from dual;
  is null
  </code></pre>
  
  <p>But when a null value is in a sequence of values (like sum of a null-able column), the calculated value of null value will be 0 <br></p>
  
  <pre><code>select sum(value) from
  (
  select case when mod(level , 2) = 0 then null else level end as value from dual
  connect by level &lt;= 10
  )
  is 25
  </code></pre>
  
  <p>This will be more interesting when seeing the result of <br></p>
  
  <pre><code>select (1 + null) from dual
  is null
  </code></pre>
  
  <p>As any operation with null will result null (except <code>is null</code> operator). <br><br>
  ========================== <br>
  <strong>Some update due to comments:</strong> <br></p>
  
  <pre><code>create table odd_table as select sum(null) as some_name from dual;
  </code></pre>
  
  <p>Will result:<br></p>
  
  <pre><code>create table ODD_TABLE
  (
    some_name NUMBER
  )
  </code></pre>
  
  <p>Why <code>some_name</code> column is of type <strong>number</strong>?</p>