Subject | FB 1.5 RC8 vs. FB 1.5 RC7 - Bugs in RC8? |
---|---|
Author | Enrico |
Post date | 2004-02-06T13:37:36Z |
Hi to all,
i have a table with a trigger on before update. In this trigger i
make some calculation using some computed by fields.
With RC7 all work fine but with RC8 the results are 0 or very
strange. It seem the computed by fields are not "fully-computed"
before using it in trigger procedure.
Anyone have see this problem ?
Here the structure of the table and the trigger:
CREATE DOMAIN "D_BOOLEAN" AS CHAR(1) DEFAULT 'F';
CREATE DOMAIN "D_DATE" AS DATE;
CREATE DOMAIN "D_IMPORTO_LIRE_EURO" AS NUMERIC(16, 2);
CREATE DOMAIN "D_KEYDB" AS INTEGER NOT NULL;
CREATE DOMAIN "D_KEYLKDB" AS INTEGER;
CREATE DOMAIN "D_MEMO" AS BLOB SUB_TYPE TEXT SEGMENT SIZE 80;
CREATE DOMAIN "D_PERCENT" AS NUMERIC(5, 2);
CREATE DOMAIN "D_USER" AS VARCHAR(32);
CREATE TABLE "PROV$ICI"
(
"KEYPROV$ICI" D_KEYDB ,
"KEYPROV$TESTATA" D_KEYLKDB ,
"ANNO" SMALLINT,
"CONSIDERAZIONI" D_MEMO ,
"MOTIVAZIONISZLIQ" D_MEMO ,
"MOTIVAZIONISZACC" D_MEMO ,
"DICHACCONTO" D_IMPORTO_LIRE_EURO ,
"DICHSALDO" D_IMPORTO_LIRE_EURO ,
"VERSACCONTO" D_IMPORTO_LIRE_EURO ,
"VERSSALDO" D_IMPORTO_LIRE_EURO ,
"VERSACCONTONOSZ" NUMERIC(16,2),
"VERSSALDONOSZ" NUMERIC(16,2),
"VERSACCONTONOINT" NUMERIC(16,2),
"VERSSALDONOINT" NUMERIC(16,2),
"VERSSANZIONI" NUMERIC(16,2),
"VERSINTERESSI" NUMERIC(16,2),
"DIFFRENDACCONTO" D_IMPORTO_LIRE_EURO ,
"DIFFRENDSALDO" D_IMPORTO_LIRE_EURO ,
"INFEDELEACCONTO" D_IMPORTO_LIRE_EURO ,
"INFEDELESALDO" D_IMPORTO_LIRE_EURO ,
"OMESSAACCONTO" D_IMPORTO_LIRE_EURO ,
"OMESSASALDO" D_IMPORTO_LIRE_EURO ,
"INTERLIQACCONTO" D_IMPORTO_LIRE_EURO ,
"INTERLIQSALDO" D_IMPORTO_LIRE_EURO ,
"INTERACCACCONTO" D_IMPORTO_LIRE_EURO ,
"INTERACCSALDO" D_IMPORTO_LIRE_EURO ,
"TARDVERSMISURA" D_PERCENT ,
"TARDVERSGGMR" SMALLINT,
"TARDVERSMISURAR" D_PERCENT ,
"TARDVERSSZACC" D_IMPORTO_LIRE_EURO ,
"TARDVERSSZSAL" D_IMPORTO_LIRE_EURO ,
"TARDVERSSZACCR" D_IMPORTO_LIRE_EURO ,
"TARDVERSSZSALR" D_IMPORTO_LIRE_EURO ,
"OMESVERSMISURA" D_PERCENT ,
"TARDDENUMISURA" D_PERCENT ,
"TARDDENUGGMR" SMALLINT,
"TARDDENUMISURAR" D_PERCENT ,
"TARDDENUSZ" D_IMPORTO_LIRE_EURO ,
"TARDDENUSZR" D_IMPORTO_LIRE_EURO ,
"INFEDENUMISURA" D_PERCENT ,
"INFEDENUSZ" D_IMPORTO_LIRE_EURO ,
"OMESDENUMISURA" D_PERCENT ,
"OMESDENUSZ" D_IMPORTO_LIRE_EURO ,
"SZIMPORTOFISSO" D_IMPORTO_LIRE_EURO ,
"SZRIDOTTE" D_IMPORTO_LIRE_EURO ,
"DICHACCONTONOINT" D_IMPORTO_LIRE_EURO ,
"DICHSALDONOINT" D_IMPORTO_LIRE_EURO ,
"DIFFRENDACCONTONOINT" D_IMPORTO_LIRE_EURO ,
"DIFFRENDSALDONOINT" D_IMPORTO_LIRE_EURO ,
"INFEDELEACCONTONOINT" D_IMPORTO_LIRE_EURO ,
"INFEDELESALDONOINT" D_IMPORTO_LIRE_EURO ,
"OMESSAACCONTONOINT" D_IMPORTO_LIRE_EURO ,
"OMESSASALDONOINT" D_IMPORTO_LIRE_EURO ,
"DICHTOTNOSZ" D_IMPORTO_LIRE_EURO ,
"DIFFRENDTOTNOSZ" D_IMPORTO_LIRE_EURO ,
"INFEDELETOTNOSZ" D_IMPORTO_LIRE_EURO ,
"OMESSATOTNOSZ" D_IMPORTO_LIRE_EURO ,
"FLAGPROVADESIONE" D_BOOLEAN DEFAULT 'F',
"OMESVERSSZ" D_IMPORTO_LIRE_EURO ,
"ESDICHACCONTO" NUMERIC(16,2),
"ESDICHSALDO" NUMERIC(16,2),
"TOTALEIMPOSTA" NUMERIC(16,2),
"TOTALEDIFFREND" COMPUTED BY (Z(DIFFRENDACCONTO)+Z
(DIFFRENDSALDO)),
"SZLIQUIDTOTALE" COMPUTED BY (Z("TARDVERSSZACC") + Z
("TARDVERSSZSAL") + Z("TARDVERSSZACCR") + Z("TARDVERSSZSALR") + Z
("OMESVERSSZ") + Z("TARDDENUSZ") + Z("TARDDENUSZR")),
"INTERTOTALE" COMPUTED BY (Z("INTERLIQACCONTO") + Z
("INTERLIQSALDO") + Z("INTERACCACCONTO") + Z("INTERACCSALDO")),
"DIFFACCONTO" COMPUTED BY (Z("DICHACCONTO") - Z("VERSACCONTO")),
"DIFFSALDO" COMPUTED BY (Z("DICHSALDO") - Z("VERSSALDO")),
"ACCERTATOACCONTO" COMPUTED BY (Z("INFEDELEACCONTO") + Z
("OMESSAACCONTO")),
"ACCERTATOSALDO" COMPUTED BY (Z("INFEDELESALDO") + Z
("OMESSASALDO")),
"ADDED" D_DATE ,
"EDITED" D_DATE ,
"DBUSER" D_USER ,
"TOTALEPENA" D_IMPORTO_LIRE_EURO ,
"XUTEFLAGIMPORTATO" D_BOOLEAN DEFAULT 'F',
"TOTALEPROV" D_IMPORTO_LIRE_EURO ,
"TOTALEPROVR" D_IMPORTO_LIRE_EURO ,
"MOTIVAZIONIPROVLIQ" D_MEMO ,
"MOTIVAZIONIPROVACC" D_MEMO ,
"XUTEVALUTA" CHAR(1),
"OMESDENUKEYTIPI" D_KEYLKDB ,
"SZMISURAFISSO" D_IMPORTO_LIRE_EURO ,
"SZFISSOMOLTIPLICATORE" SMALLINT,
"SZACCERTOTALE" COMPUTED BY (Z("INFEDENUSZ") + Z
("OMESDENUSZ") + Z("SZIMPORTOFISSO")),
"SZTOTALE" COMPUTED BY (Z("SZLIQUIDTOTALE") + Z
("SZACCERTOTALE")),
"INTERESSIDEBITO" D_IMPORTO_LIRE_EURO ,
"INTERESSIRIMBORSO" D_IMPORTO_LIRE_EURO ,
"OMESDENUMISURANFR" D_PERCENT ,
"OMESDENUSZNFR" D_IMPORTO_LIRE_EURO ,
"MODIFICASANZIONI" D_BOOLEAN DEFAULT 'F',
CONSTRAINT "PROV$ICI_PK" PRIMARY KEY ("KEYPROV$ICI")
);
ALTER TABLE "PROV$ICI" ADD CONSTRAINT "PROV$ICI" FOREIGN KEY
("KEYPROV$TESTATA") REFERENCES "PROV$TESTATA" ("KEYPROV$TESTATA") ON
UPDATE CASCADE ON DELETE CASCADE;
SET TERM ^ ;
CREATE TRIGGER "PROV$ICI_BU_GESTIONE" FOR "PROV$ICI"
ACTIVE BEFORE UPDATE POSITION 50
AS
DECLARE VARIABLE VTOTIMPOSTA NUMERIC(16,2);
DECLARE VARIABLE VTOTCONVERTITO NUMERIC(16,2);
DECLARE VARIABLE VINTERTOTALE NUMERIC(16,2);
DECLARE VARIABLE VSZTOTALE NUMERIC(16,2);
DECLARE VARIABLE VSZLIQUIDTOTALE NUMERIC(16,2);
DECLARE VARIABLE VSZACCERTOTALE NUMERIC(16,2);
BEGIN
VTOTIMPOSTA = Z(NEW.DIFFRENDACCONTO) + Z(NEW.DIFFRENDSALDO)
+ (Z(NEW.DICHACCONTO) - Z(NEW.VERSACCONTO)) + (Z
(NEW.DICHSALDO) - Z(NEW.VERSSALDO))
+ (Z(NEW.INFEDELEACCONTO) + Z(NEW.OMESSAACCONTO)) +
(Z(NEW.INFEDELESALDO) + Z(NEW.OMESSASALDO));
IF ( NEW.XUTEFLAGIMPORTATO IS NULL OR NEW.XUTEFLAGIMPORTATO !
= 'T' ) THEN
BEGIN
SELECT IMPCONVERTITO
FROM FUNZ$CONVERTIEURO (NEW.ANNO, :VTOTIMPOSTA)
INTO VTOTCONVERTITO;
NEW.TOTALEIMPOSTA = VTOTCONVERTITO;
VINTERTOTALE = (Z(NEW.INTERLIQACCONTO) + Z(NEW.INTERLIQSALDO) +
Z(NEW.INTERACCACCONTO) + Z(NEW.INTERACCSALDO));
VSZLIQUIDTOTALE = (Z(NEW.TARDVERSSZACC) + Z(NEW.TARDVERSSZSAL)
+ Z(NEW.TARDVERSSZACCR) + Z(NEW.TARDVERSSZSALR) + Z(NEW.OMESVERSSZ) +
Z(NEW.TARDDENUSZ) + Z(NEW.TARDDENUSZR));
VSZACCERTOTALE = (Z(NEW.INFEDENUSZ) + Z(NEW.OMESDENUSZ) + Z
(NEW.SZIMPORTOFISSO));
VSZTOTALE = VSZLIQUIDTOTALE + VSZACCERTOTALE;
NEW.TOTALEPROV = (Z(NEW.TOTALEIMPOSTA) + VSZTOTALE +
VINTERTOTALE) - (Z(NEW.VERSSANZIONI) + Z(NEW.VERSINTERESSI));
NEW.TOTALEPROVR = (Z(NEW.TOTALEIMPOSTA) + Z(NEW.SZRIDOTTE) +
VINTERTOTALE) - (Z(NEW.VERSSANZIONI) + Z(NEW.VERSINTERESSI));
END
END
^
SET TERM ; ^
i have a table with a trigger on before update. In this trigger i
make some calculation using some computed by fields.
With RC7 all work fine but with RC8 the results are 0 or very
strange. It seem the computed by fields are not "fully-computed"
before using it in trigger procedure.
Anyone have see this problem ?
Here the structure of the table and the trigger:
CREATE DOMAIN "D_BOOLEAN" AS CHAR(1) DEFAULT 'F';
CREATE DOMAIN "D_DATE" AS DATE;
CREATE DOMAIN "D_IMPORTO_LIRE_EURO" AS NUMERIC(16, 2);
CREATE DOMAIN "D_KEYDB" AS INTEGER NOT NULL;
CREATE DOMAIN "D_KEYLKDB" AS INTEGER;
CREATE DOMAIN "D_MEMO" AS BLOB SUB_TYPE TEXT SEGMENT SIZE 80;
CREATE DOMAIN "D_PERCENT" AS NUMERIC(5, 2);
CREATE DOMAIN "D_USER" AS VARCHAR(32);
CREATE TABLE "PROV$ICI"
(
"KEYPROV$ICI" D_KEYDB ,
"KEYPROV$TESTATA" D_KEYLKDB ,
"ANNO" SMALLINT,
"CONSIDERAZIONI" D_MEMO ,
"MOTIVAZIONISZLIQ" D_MEMO ,
"MOTIVAZIONISZACC" D_MEMO ,
"DICHACCONTO" D_IMPORTO_LIRE_EURO ,
"DICHSALDO" D_IMPORTO_LIRE_EURO ,
"VERSACCONTO" D_IMPORTO_LIRE_EURO ,
"VERSSALDO" D_IMPORTO_LIRE_EURO ,
"VERSACCONTONOSZ" NUMERIC(16,2),
"VERSSALDONOSZ" NUMERIC(16,2),
"VERSACCONTONOINT" NUMERIC(16,2),
"VERSSALDONOINT" NUMERIC(16,2),
"VERSSANZIONI" NUMERIC(16,2),
"VERSINTERESSI" NUMERIC(16,2),
"DIFFRENDACCONTO" D_IMPORTO_LIRE_EURO ,
"DIFFRENDSALDO" D_IMPORTO_LIRE_EURO ,
"INFEDELEACCONTO" D_IMPORTO_LIRE_EURO ,
"INFEDELESALDO" D_IMPORTO_LIRE_EURO ,
"OMESSAACCONTO" D_IMPORTO_LIRE_EURO ,
"OMESSASALDO" D_IMPORTO_LIRE_EURO ,
"INTERLIQACCONTO" D_IMPORTO_LIRE_EURO ,
"INTERLIQSALDO" D_IMPORTO_LIRE_EURO ,
"INTERACCACCONTO" D_IMPORTO_LIRE_EURO ,
"INTERACCSALDO" D_IMPORTO_LIRE_EURO ,
"TARDVERSMISURA" D_PERCENT ,
"TARDVERSGGMR" SMALLINT,
"TARDVERSMISURAR" D_PERCENT ,
"TARDVERSSZACC" D_IMPORTO_LIRE_EURO ,
"TARDVERSSZSAL" D_IMPORTO_LIRE_EURO ,
"TARDVERSSZACCR" D_IMPORTO_LIRE_EURO ,
"TARDVERSSZSALR" D_IMPORTO_LIRE_EURO ,
"OMESVERSMISURA" D_PERCENT ,
"TARDDENUMISURA" D_PERCENT ,
"TARDDENUGGMR" SMALLINT,
"TARDDENUMISURAR" D_PERCENT ,
"TARDDENUSZ" D_IMPORTO_LIRE_EURO ,
"TARDDENUSZR" D_IMPORTO_LIRE_EURO ,
"INFEDENUMISURA" D_PERCENT ,
"INFEDENUSZ" D_IMPORTO_LIRE_EURO ,
"OMESDENUMISURA" D_PERCENT ,
"OMESDENUSZ" D_IMPORTO_LIRE_EURO ,
"SZIMPORTOFISSO" D_IMPORTO_LIRE_EURO ,
"SZRIDOTTE" D_IMPORTO_LIRE_EURO ,
"DICHACCONTONOINT" D_IMPORTO_LIRE_EURO ,
"DICHSALDONOINT" D_IMPORTO_LIRE_EURO ,
"DIFFRENDACCONTONOINT" D_IMPORTO_LIRE_EURO ,
"DIFFRENDSALDONOINT" D_IMPORTO_LIRE_EURO ,
"INFEDELEACCONTONOINT" D_IMPORTO_LIRE_EURO ,
"INFEDELESALDONOINT" D_IMPORTO_LIRE_EURO ,
"OMESSAACCONTONOINT" D_IMPORTO_LIRE_EURO ,
"OMESSASALDONOINT" D_IMPORTO_LIRE_EURO ,
"DICHTOTNOSZ" D_IMPORTO_LIRE_EURO ,
"DIFFRENDTOTNOSZ" D_IMPORTO_LIRE_EURO ,
"INFEDELETOTNOSZ" D_IMPORTO_LIRE_EURO ,
"OMESSATOTNOSZ" D_IMPORTO_LIRE_EURO ,
"FLAGPROVADESIONE" D_BOOLEAN DEFAULT 'F',
"OMESVERSSZ" D_IMPORTO_LIRE_EURO ,
"ESDICHACCONTO" NUMERIC(16,2),
"ESDICHSALDO" NUMERIC(16,2),
"TOTALEIMPOSTA" NUMERIC(16,2),
"TOTALEDIFFREND" COMPUTED BY (Z(DIFFRENDACCONTO)+Z
(DIFFRENDSALDO)),
"SZLIQUIDTOTALE" COMPUTED BY (Z("TARDVERSSZACC") + Z
("TARDVERSSZSAL") + Z("TARDVERSSZACCR") + Z("TARDVERSSZSALR") + Z
("OMESVERSSZ") + Z("TARDDENUSZ") + Z("TARDDENUSZR")),
"INTERTOTALE" COMPUTED BY (Z("INTERLIQACCONTO") + Z
("INTERLIQSALDO") + Z("INTERACCACCONTO") + Z("INTERACCSALDO")),
"DIFFACCONTO" COMPUTED BY (Z("DICHACCONTO") - Z("VERSACCONTO")),
"DIFFSALDO" COMPUTED BY (Z("DICHSALDO") - Z("VERSSALDO")),
"ACCERTATOACCONTO" COMPUTED BY (Z("INFEDELEACCONTO") + Z
("OMESSAACCONTO")),
"ACCERTATOSALDO" COMPUTED BY (Z("INFEDELESALDO") + Z
("OMESSASALDO")),
"ADDED" D_DATE ,
"EDITED" D_DATE ,
"DBUSER" D_USER ,
"TOTALEPENA" D_IMPORTO_LIRE_EURO ,
"XUTEFLAGIMPORTATO" D_BOOLEAN DEFAULT 'F',
"TOTALEPROV" D_IMPORTO_LIRE_EURO ,
"TOTALEPROVR" D_IMPORTO_LIRE_EURO ,
"MOTIVAZIONIPROVLIQ" D_MEMO ,
"MOTIVAZIONIPROVACC" D_MEMO ,
"XUTEVALUTA" CHAR(1),
"OMESDENUKEYTIPI" D_KEYLKDB ,
"SZMISURAFISSO" D_IMPORTO_LIRE_EURO ,
"SZFISSOMOLTIPLICATORE" SMALLINT,
"SZACCERTOTALE" COMPUTED BY (Z("INFEDENUSZ") + Z
("OMESDENUSZ") + Z("SZIMPORTOFISSO")),
"SZTOTALE" COMPUTED BY (Z("SZLIQUIDTOTALE") + Z
("SZACCERTOTALE")),
"INTERESSIDEBITO" D_IMPORTO_LIRE_EURO ,
"INTERESSIRIMBORSO" D_IMPORTO_LIRE_EURO ,
"OMESDENUMISURANFR" D_PERCENT ,
"OMESDENUSZNFR" D_IMPORTO_LIRE_EURO ,
"MODIFICASANZIONI" D_BOOLEAN DEFAULT 'F',
CONSTRAINT "PROV$ICI_PK" PRIMARY KEY ("KEYPROV$ICI")
);
ALTER TABLE "PROV$ICI" ADD CONSTRAINT "PROV$ICI" FOREIGN KEY
("KEYPROV$TESTATA") REFERENCES "PROV$TESTATA" ("KEYPROV$TESTATA") ON
UPDATE CASCADE ON DELETE CASCADE;
SET TERM ^ ;
CREATE TRIGGER "PROV$ICI_BU_GESTIONE" FOR "PROV$ICI"
ACTIVE BEFORE UPDATE POSITION 50
AS
DECLARE VARIABLE VTOTIMPOSTA NUMERIC(16,2);
DECLARE VARIABLE VTOTCONVERTITO NUMERIC(16,2);
DECLARE VARIABLE VINTERTOTALE NUMERIC(16,2);
DECLARE VARIABLE VSZTOTALE NUMERIC(16,2);
DECLARE VARIABLE VSZLIQUIDTOTALE NUMERIC(16,2);
DECLARE VARIABLE VSZACCERTOTALE NUMERIC(16,2);
BEGIN
VTOTIMPOSTA = Z(NEW.DIFFRENDACCONTO) + Z(NEW.DIFFRENDSALDO)
+ (Z(NEW.DICHACCONTO) - Z(NEW.VERSACCONTO)) + (Z
(NEW.DICHSALDO) - Z(NEW.VERSSALDO))
+ (Z(NEW.INFEDELEACCONTO) + Z(NEW.OMESSAACCONTO)) +
(Z(NEW.INFEDELESALDO) + Z(NEW.OMESSASALDO));
IF ( NEW.XUTEFLAGIMPORTATO IS NULL OR NEW.XUTEFLAGIMPORTATO !
= 'T' ) THEN
BEGIN
SELECT IMPCONVERTITO
FROM FUNZ$CONVERTIEURO (NEW.ANNO, :VTOTIMPOSTA)
INTO VTOTCONVERTITO;
NEW.TOTALEIMPOSTA = VTOTCONVERTITO;
VINTERTOTALE = (Z(NEW.INTERLIQACCONTO) + Z(NEW.INTERLIQSALDO) +
Z(NEW.INTERACCACCONTO) + Z(NEW.INTERACCSALDO));
VSZLIQUIDTOTALE = (Z(NEW.TARDVERSSZACC) + Z(NEW.TARDVERSSZSAL)
+ Z(NEW.TARDVERSSZACCR) + Z(NEW.TARDVERSSZSALR) + Z(NEW.OMESVERSSZ) +
Z(NEW.TARDDENUSZ) + Z(NEW.TARDDENUSZR));
VSZACCERTOTALE = (Z(NEW.INFEDENUSZ) + Z(NEW.OMESDENUSZ) + Z
(NEW.SZIMPORTOFISSO));
VSZTOTALE = VSZLIQUIDTOTALE + VSZACCERTOTALE;
NEW.TOTALEPROV = (Z(NEW.TOTALEIMPOSTA) + VSZTOTALE +
VINTERTOTALE) - (Z(NEW.VERSSANZIONI) + Z(NEW.VERSINTERESSI));
NEW.TOTALEPROVR = (Z(NEW.TOTALEIMPOSTA) + Z(NEW.SZRIDOTTE) +
VINTERTOTALE) - (Z(NEW.VERSSANZIONI) + Z(NEW.VERSINTERESSI));
END
END
^
SET TERM ; ^