"localhost:/firebird/data/ILICHEVSK2.FDB". Процедуры Previous topic Chapter index Next topic

UWORDERS_UPDATEQUALITY

 

Входные параметры

Параметр

Тип

Описание

QUALITYID

INTEGER

 

CROPID

INTEGER

 

CLASSID

INTEGER

 

SORTID

INTEGER

 

HUMIDITY

NUMERIC(4,2)

 

DIRT

NUMERIC(4,2)

 

SCREENING

NUMERIC(4,2)

 

 

Выходные параметры

(Нет выходных параметров)

 

Описание

(Нет описания для процедуры UWORDERS_UPDATEQUALITY)

 

Определение

CREATE PROCEDURE UWORDERS_UPDATEQUALITY(
    QUALITYID INTEGER,
    CROPID INTEGER,
    CLASSID INTEGER,
    SORTID INTEGER,
    HUMIDITY NUMERIC(4,2),
    DIRT NUMERIC(4,2),
    SCREENING NUMERIC(4,2))
AS
begin
  if (not exists (select QUALITYID from QUALITY where (QUALITYID = :QUALITYID))) then begin
    if (QUALITYID is null) then
      QUALITYID = gen_id(QUALITYIDGEN, 1);

    insert into QUALITY(QUALITYID, CROPID, SORTID, CLASSID) values (:QUALITYID, :CROPID, :SORTID, :CLASSID);
  end
  else begin
    update QUALITY set
      CROPID = :CROPID,
      SORTID = :SORTID,
      CLASSID = :CLASSID
    where (QUALITYID = :QUALITYID);

    delete from QUALITYDATA
      where (QUALITYID = :QUALITYID);
  end

  insert into QUALITYDATA values (:QUALITYID, 2, :HUMIDITY);
  insert into QUALITYDATA values (:QUALITYID, 13, :DIRT);
  insert into QUALITYDATA values (:QUALITYID, 14, :SCREENING);

  suspend;
end

 

     Previous topic Chapter index Next topic