Código Delphi
[-]SET TERM ^ ;
CREATE OR ALTER PROCEDURE NEW_PROCEDURE2 (
in_random decimal(12,0))
returns (
out_random decimal(12,0))
as
declare variable aux_rand decimal(12,0);
declare variable aux_rand2 decimal(12,0);
declare variable aux_true integer;
begin
Select RANDOMNO from PRUEBA
where RANDOMNO = :"IN_RANDOM"
rows 1
into AUX_RAND;
if (:"AUX_RAND" is not null) then
IN_RANDOM = IN_RANDOM + 1;
Select RANDOMNO from PRUEBA
where RANDOMNO = :"IN_RANDOM"
rows 1
into AUX_RAND;
if (:"AUX_RAND" is not null) then
IN_RANDOM = IN_RANDOM + 1;
OUT_RANDOM = IN_RANDOM;
suspend;
end
^
SET TERM ; ^
Por qué esta modificación, si ejecuto con el valor de entrada 1, entonces me devuelve 3 (!!!
) y si el valor de entrada es 2, entonces me devuelve 2 !!
Parece como si no gestionase correctamente la Suma + 1 del parámetro de Entrada In_Random. Pero es que como ya dije anteriormente lo he probado incluso con variables propias del procedimiento, sin tocar la variable de entrada, y tampoco ....