I need to bring the sum of 2 data:
dato1 = 1
dato2 = 2
totalsuma = 3
Currently I do it like this:
SET totalsuma = (SELECT SUM(dato1+dato2) from tabla WHERE CODIGO = codigo_new);
up there all right the totalsum variable takes me the value 3, the problem I have when some of the data has zero value, eg:
dato1 = 1
dato2 = null
totalsuma = null
When I have some of the data in null
, the expected task is simply not performed.
Someone can help me in my stored procedure , thank you very much.