Описание
(Нет описания для триггера QUALITY_SET_CLASSID)
Определение
CREATE TRIGGER QUALITY_SET_CLASSID FOR QUALITY
ACTIVE BEFORE INSERT OR UPDATE POSITION 0
AS
declare variable ClassCount integer;
declare variable ClassID integer;
begin
if (new.classid is null and new.cropid is not null) then begin
select min(ClassID), count(classid)
from class where cropid = new.cropid
into :ClassID, :ClassCount;
if (:ClassCount = 1) then new.classid = :ClassID;
end
end