Hi all!
In Apex 19.2
Am having this invalid number error with a DA PL/SQL action that converts numbers to negative:

PL/SQL code:
declare
nPrima number;
nDerrama number;
nCargo_adicional number;
begin
if :P33_TIPO_FACTURA IN ('Crédito','Cancelación') then
select -SIGN(to_number(:P33_PRIMA))*to_number(:P33_PRIMA) INTO nPrima FROM DUAL;
:P33_PRIMA := to_char(nPrima);
select -SIGN(to_number(:P33_DERRAMA))*to_number(:P33_DERRAMA) INTO nDerrama FROM DUAL;
:P33_DERRAMA := to_char(nDerrama);
select -SIGN(to_number(:P33_CARGO_ADICIONAL))*to_number(:P33_CARGO_ADICIONAL) INTO nCargo_adicional FROM DUAL;
:P33_CARGO_ADICIONAL := to_char(nCargo_adicional);
end if;
end;
When adding the record the values of the items are calculate this way in session state:

Everything works fine.
But when modifying the page and items are formatted

I get the error.
The P33_PRIMA item is type number and this is its format mask:

At least this is what I figured, that there is a problem with the format mask and values once the items is saved.
What could be wrong with the code?
Hope I explain the problem well!
Thanks for the help!