... ahora lo pruebo ....
... PEOR todavía .....
Código Delphi
[-]begin
AUX_RAND2 = IN_RANDOM;
Select RANDOMNO from PRUEBA
where RANDOMNO = 1
rows 1
into AUX_RAND;
if (:"AUX_RAND" is not null) then
AUX_RAND2 = AUX_RAND2 + 1;
Select RANDOMNO from PRUEBA
where RANDOMNO = 2
rows 1
into AUX_RAND;
if (:"AUX_RAND" is not null) then
AUX_RAND2 = AUX_RAND2 + 2;
OUT_RANDOM = AUX_RAND2;
suspend;
end
Si lo ejecuto con 1 de entrada, entonces el primer Select encuentra un valor, y suma 1 a la entrada. Correcto. El segundo Select busca un 2 en la base de datos, QUE NO EXISTE !. A pesar de eso, al parecer Aux_Rand is not null y suma otros 2 a Aux_Rand2, y me devuelve 4 !!!
Por qué carajo el segundo select me devuelve un valor que no es null ???