Subject | execute procedure |
---|---|
Author | grat007 |
Post date | 2003-06-18T07:23:58Z |
hi,
i am beginer with firebird. I have stored procedure and if i debug it
step by step, is all correct. But if i call "execute procedure
proc_name(5,10)" all is ok but there is not change in table. Where i
have bug?
milan
SET TERM ^^ ;
CREATE PROCEDURE RENEW_PRODEJNA (IIPR Integer, IDINV Integer)
AS
DECLARE VARIABLE ccena NUMERIC (9, 2);
DECLARE VARIABLE iibal integer;
DECLARE VARIABLE IIKAT integer;
DECLARE VARIABLE IIKRT integer;
DECLARE VARIABLE cpocet integer;
DECLARE VARIABLE ckod char(12);
DECLARE VARIABLE IN_PR integer;
DECLARE VARIABLE IN_INV integer;
begin
/* EMPTY OLD PRODEJNA */
IN_PR = CAST(IIPR AS INTEGER); -> this testet
IN_INV = CAST(IDINV AS INTEGER);
UPDATE KARTY SET POCET=0 WHERE ID_PRODEJNA=:IN_PR;
FOR SELECT ID_BALENI FROM BALENI WHERE ID_PRIJEM= :IN_INV INTO :iibal
-> row > 40
DO BEGIN
FOR SELECT KOD,POCET,CENA FROM INV_ZBOZI WHERE ID_BALENI = :iibal
INTO :ckod,cpocet,ccena -> row cca 30
DO BEGIN
IIKAT = NULL;
SELECT FIRST 1 K.ID_KAT FROM KARTY K,KATEGORIE A WHERE
K.ID_KAT=A.ID_KAT AND K.ID_PRODEJNA=0 AND A.KOD=:CKOD INTO :IIKAT;
IF (IIKAT IS NULL) THEN
BEGIN
execute procedure KATEGORIE_I (NULL,:CKOD,'
',:CCENA,22,'ks') returning_values :IIKAT;
IIKAT = GEN_ID(KATEGORIE_ID_KAT_GEN, 0);
execute procedure KARTY_I (:IIKAT,0,0) returning_values :IIKRT;
execute procedure KARTY_I (:IIKAT,:CPOCET,:IN_PR)
returning_values :IIKRT;
END
ELSE
BEGIN
/* aktualizovat cenu */
UPDATE KATEGORIE SET KATEGORIE.CENA=:CCENA WHERE
KATEGORIE.ID_KAT=:IIKAT;
/*existuje v prodejne*/
IIKRT = NULL;
SELECT FIRST 1 K.ID_KARTA FROM KARTY K WHERE K.ID_KAT=:IIKAT
AND K.ID_PRODEJNA=:IN_PR INTO :IIKRT;
IF (IIKRT IS NULL) THEN
BEGIN
/* Pro prodejnu neexistuje*/
execute procedure KARTY_I (:IIKAT,:CPOCET,:IN_PR)
returning_values :IIKAT;
END
ELSE
BEGIN
execute procedure KARTY_U (:IIKRT,:CPOCET,:IN_PR);
END
END
SUSPEND;
END
SUSPEND;
END
END
^^
SET TERM ; ^^
i am beginer with firebird. I have stored procedure and if i debug it
step by step, is all correct. But if i call "execute procedure
proc_name(5,10)" all is ok but there is not change in table. Where i
have bug?
milan
SET TERM ^^ ;
CREATE PROCEDURE RENEW_PRODEJNA (IIPR Integer, IDINV Integer)
AS
DECLARE VARIABLE ccena NUMERIC (9, 2);
DECLARE VARIABLE iibal integer;
DECLARE VARIABLE IIKAT integer;
DECLARE VARIABLE IIKRT integer;
DECLARE VARIABLE cpocet integer;
DECLARE VARIABLE ckod char(12);
DECLARE VARIABLE IN_PR integer;
DECLARE VARIABLE IN_INV integer;
begin
/* EMPTY OLD PRODEJNA */
IN_PR = CAST(IIPR AS INTEGER); -> this testet
IN_INV = CAST(IDINV AS INTEGER);
UPDATE KARTY SET POCET=0 WHERE ID_PRODEJNA=:IN_PR;
FOR SELECT ID_BALENI FROM BALENI WHERE ID_PRIJEM= :IN_INV INTO :iibal
-> row > 40
DO BEGIN
FOR SELECT KOD,POCET,CENA FROM INV_ZBOZI WHERE ID_BALENI = :iibal
INTO :ckod,cpocet,ccena -> row cca 30
DO BEGIN
IIKAT = NULL;
SELECT FIRST 1 K.ID_KAT FROM KARTY K,KATEGORIE A WHERE
K.ID_KAT=A.ID_KAT AND K.ID_PRODEJNA=0 AND A.KOD=:CKOD INTO :IIKAT;
IF (IIKAT IS NULL) THEN
BEGIN
execute procedure KATEGORIE_I (NULL,:CKOD,'
',:CCENA,22,'ks') returning_values :IIKAT;
IIKAT = GEN_ID(KATEGORIE_ID_KAT_GEN, 0);
execute procedure KARTY_I (:IIKAT,0,0) returning_values :IIKRT;
execute procedure KARTY_I (:IIKAT,:CPOCET,:IN_PR)
returning_values :IIKRT;
END
ELSE
BEGIN
/* aktualizovat cenu */
UPDATE KATEGORIE SET KATEGORIE.CENA=:CCENA WHERE
KATEGORIE.ID_KAT=:IIKAT;
/*existuje v prodejne*/
IIKRT = NULL;
SELECT FIRST 1 K.ID_KARTA FROM KARTY K WHERE K.ID_KAT=:IIKAT
AND K.ID_PRODEJNA=:IN_PR INTO :IIKRT;
IF (IIKRT IS NULL) THEN
BEGIN
/* Pro prodejnu neexistuje*/
execute procedure KARTY_I (:IIKAT,:CPOCET,:IN_PR)
returning_values :IIKAT;
END
ELSE
BEGIN
execute procedure KARTY_U (:IIKRT,:CPOCET,:IN_PR);
END
END
SUSPEND;
END
SUSPEND;
END
END
^^
SET TERM ; ^^