>sum(a.tvol)-NVL(sum(b.totcxlvol),000) as tvoladj;
>or
>NVL(sum(a.tvol)-sum(b.totcxlvol),sum(a.tvol) ) as tvoladj;
>
>Which syntax is better?
>
>I was wondering if the duplicate occurance of "sum(a.tvol)" was a performance killer.
I think the correct phrasing would be:
SUM(a.tvol) - SUM(NVL(b.totcxlvol,000)) as tvoladj
since the occurance of b.totcxlvol might be null on any given instance, rahter than the sum being NULL; I'm not certain that this applies inside the SUM() phrase in a select, but try the following to become a potentially unhappy camper:
? 3 + NULL