Описание
(Нет описания для триггера SILAGE_CalcSilagePacksWeight)
Определение
CREATE TRIGGER "SILAGE_CalcSilagePacksWeight" FOR SILAGE
ACTIVE AFTER UPDATE POSITION 2
AS
begin
if (not(new.weight is null) and
(((old.weight is null) and (new.weight <> 0)) or
((old.weight <> new.weight) and not(old.weight is null))))
then
update silagepacks
set weight = (select sum(weight)
from silage
where silagepackid = old.silagepackid)
where silagepackid = old.silagepackid;
END