I try to update a field with its own value added to a value returned from a query. The problem is that when the value returned is nullo, that is, there was no return, at the time of adding, the end result is null as well.
How do I transform this null return in zero?
follows the code:
update TABELA_GERAL ect
set VALOR_PAGO = VALOR_PAGO +(select NVL(soma_paga ,0)
from(select cod, sum(NVL(valor,0)) as soma_paga
from tabela1
where dt_criacao between p_data_inicio And p_data_fim
and (esquema = 'TEXTO1' OR esquema = 'TEXTO')
group by cod_dealer)soma
where soma.cod = ect.pdv);
commit;