title: Sum columns with null values in oracle
body: <p>I want to add two numbers together but when one of those numbers is null then the result is null.  Is there a way around this.  I could simply do it in the code but I would rather have it done in the query.  This is a oracle database.</p>
  
  <p><strong>The table structure</strong></p>
  
  <pre><code>hours_t
  type     craft    regular       overtime
   A         1        5              0
   A         1        3              1
   B         2        9            &lt;null&gt;
   B         1        4              4
  </code></pre>
  
  <p><strong>The query</strong></p>
  
  <pre><code>select type, craft, sum(regular + overtime) as total_hours
  from hours_t
  group by type, craft
  order by type, craft
  </code></pre>
  
  <p><strong>The unwanted results</strong></p>
  
  <pre><code>type   craft   total_hours
    A      1          9
    B      1          8
    B      2        &lt;null&gt;
  </code></pre>
  
  <p><strong>The wanted results</strong></p>
  
  <pre><code>type    craft   total_hours
    A       1          9
    B       1          8
    B       2          9
  </code></pre>