It would be appreciated explaining the internal functionality of SUM function in Oracle, when encountering null values:
The result of
select sum(null)
If you are looking for a rationale for this behaviour, then it is to be found in the ANSI SQL standards which dictate that aggregate operators ignore NULL values.
If you wanted to override that behaviour then you're free to:
Sum(Coalesce(,0))
... although it would make more sense with Sum() to ...
Coalesce(Sum(),0)
You might more meaningfully:
Avg(Coalesce(,0))
... or ...
Min(Coalesce(
Other ANSI aggregation quirks:
So ...
Coalesce(Count(),0)
... is a waste of a good coalesce.