Addition with NULL values

后端 未结 5 795
傲寒
傲寒 2020-12-10 11:00

In a stored procedure (Oracle in my case), I want to add some values to an existing record. Problem is that both the existing value and the value to be added can be null. I

5条回答
  •  一生所求
    2020-12-10 11:14

    You can also use ISNULL, so if you have 3 values

    isnull(val1,0)+isnull(val2,0)+isnull(val3,0)
    

    which ever column will have a NULL will use a 0, otherwise its original value.

提交回复
热议问题