title: Decimal Arithmetic Overflow
body: <p>I simply can't work this out, I'm attempting to sum the value of TOTAL based on the condition below, which causes an ArithmeticOverflow:</p>
  
  <pre><code>var rawData = (from e in Context.TOTALS
                  where (e.PAN == "2600000246701" || e.PAN == "2600000246696")
                  select e.TOTAL).Sum();
  </code></pre>
  
  <p>However if I seperate the condition out into two seperate queries it works:</p>
  
  <pre><code>var rawData1 = (from e in Context.TOTALS
                  where (e.PAN == "2600000246696")
                  select e.TOTAL).FirstOrDefault();
  
  var rawData2 = (from e in Context.TOTALS
                   where (e.PAN == "2600000246701")
                   select e.TOTAL).FirstOrDefault();
  
  decimal? output = rawData1 + rawData2; //output is 696768.0186M
  </code></pre>
  
  <p>The value clearly fits into a decimal, and I can't see why there would be any narrowing conversions going on.</p>
  
  <p>I'm using Entity Framework with an Oracle backend.</p>