Why SUM(null) is not 0 in Oracle?

前端 未结 6 1982
轻奢々
轻奢々 2021-01-04 08:33

It would be appreciated explaining the internal functionality of SUM function in Oracle, when encountering null values:
The result of

select sum(null)          


        
6条回答
  •  庸人自扰
    2021-01-04 08:43

    This is incorrect: The sum of 0 + null + 1 + 2 is 3; select 0 + null + 1 + 2 total from dual;

    Result is null! Similar statements give result null if any operand is null.

提交回复
热议问题