"localhost:/firebird/data/ILICHEVSK2.FDB". Триггеры Previous topic Chapter index Next topic

QUALITY_SET_CLASSID

 

Описание

(Нет описания для триггера 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

 

     Previous topic Chapter index Next topic