Subject bug in procedure
Author grat007
i'm have FB 1.5 RC4 and this procedure. after execute on last END is
err:-802

arithmetic exception, numeric overflow, or string truncation.

where is bug?

thanks
Milan
----------------------------------------
begin
IN_PR = CAST(IIPR AS INTEGER);
IN_INV = CAST(IDINV AS INTEGER);

/* EMPTY OLD PRODEJNA */
UPDATE KARTY SET POCET=0 WHERE ID_PRODEJNA=:IN_PR;
FOR SELECT ID_BALENI FROM BALENI WHERE ID_PRIJEM= :IN_INV INTO
:IIBAL
DO BEGIN
FOR SELECT KOD,POCET,CENA,V1,V2 FROM INV_ZBOZI WHERE
ID_BALENI = :IIBAL INTO :ckod,:cpocet,:ccena,:in_v1,:in_v2
DO BEGIN
/* Exist ?*/
IIKAT = NULL;
SELECT FIRST 1 ID_KAT FROM KATEGORIE WHERE KOD=:CKOD
INTO :IIKAT;
IF (IIKAT IS NULL) THEN BEGIN
execute procedure KATEGORIE_I (:CKOD,'
',:CCENA,22,'ks') returning_values :IIKAT;
execute procedure KARTY_I
(:IIKAT,0,0,:in_v1,:in_v2,:CCENA) returning_values :IIKRT;
execute procedure KARTY_I
(:IIKAT,:CPOCET,:IN_PR,:in_v1,:in_v2,:CCENA) returning_values :IIKRT;
END
ELSE
BEGIN
/* price kategorie */
UPDATE KATEGORIE SET KATEGORIE.CENA=:CCENA
WHERE KATEGORIE.ID_KAT=:IIKAT;
/* test if exist karta with v1,v2 */
IIKRT = NULL;
SELECT FIRST 1 ID_KARTA FROM KARTY WHERE
ID_KAT=:IIKAT AND ID_PRODEJNA=0
AND V1=:in_v1 AND V2=:in_v2 INTO :IIKRT;
IF (IIKRT IS NULL) THEN BEGIN /* NenĂ­ karta */
execute procedure KARTY_I
(:IIKAT,0,0,:in_v1,:in_v2,:CCENA) returning_values :IIKRT;
execute procedure KARTY_I
(:IIKAT,:CPOCET,:IN_PR,:in_v1,:in_v2,:CCENA) returning_values :IIKRT;
END
ELSE
BEGIN
/* test jesli existuje s vlastnostma
na prodejne*/
execute procedure KARTY_U
(:IIKRT,0,0,:in_v1,:in_v2,:CCENA);
IIKRT = NULL;
SELECT FIRST 1 ID_KARTA FROM KARTY
WHERE ID_KAT=:IIKAT AND ID_PRODEJNA=:IIPR
AND V1=:in_v1 AND V2=:in_v2
INTO :IIKRT;
IF (IIKRT IS NULL) THEN BEGIN /* NenĂ­
v kategorii */
execute procedure KARTY_I
(:IIKAT,:CPOCET,:IN_PR,:in_v1,:in_v2,:CCENA) returning_values :IIKRT;
END
ELSE
BEGIN
execute procedure KARTY_U
(:IIKRT,:CPOCET,:IN_PR,:in_v1,:in_v2,:CCENA);
END
END
END
END
END
end