Subject RE: [ib-support] Re: Wrong calculations inside trigger
Author Alan McDonald
SELECT SP_WI+ON_WI-ON_MI,(SP_WI+ON_WI-ON_MI)*CENA,CENA FROM M9003
WHERE M9003.INDEKS=NEW.INDEKS
INTO :STANI,:STANW,:CENASTARA;
IF (STANI+NEW.ILOSC>0.0) THEN
CENANOWA=(STANW+NEW.ILOSC*NEW.CENA)/(STANI+NEW.ILOSC);
/* here!!!*/
ELSE
CENANOWA=NEW.CENA;
UPDATE M9003 SET ON_WI=ON_WI+NEW.ILOSC,CENA=:CENANOWA WHERE
M9003.INDEKS=NEW.INDEKS;

So there's a one to one relationship between the table to which this trigger
applies and M9003

I suppose you have adequately protected this trigger against Null values? I
don't see any protection but it may be elsewhere.

I can't comment on what might be happening with event management. i would
recommend getting your trigger working without any event interaction first
off perhaps.
Alan