Описание
(Нет описания для триггера QUALITY_SET_CROPCLASSID)
Определение
CREATE TRIGGER QUALITY_SET_CROPCLASSID 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
  else if (new.classid is not null and new.cropid is null) then
  begin
    select CropID
    from class
    where ClassID = new.ClassID
    into new.CropID;
  end
end
         
         
         
       |