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

SILAGEPACKS_CONTENT

 

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

Параметр

Тип

Описание

SILAGEPACKID

INTEGER

 

 

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

Параметр

Тип

Описание

CONTENT

VARCHAR(100)

 

FACTORFILLING

NUMERIC(5,4)

 

 

Описание

Получение полного названия культуры в SilagePack или соответствующего направления на мельзывод при помоле

 

Определение

CREATE PROCEDURE SILAGEPACKS_CONTENT(
    SILAGEPACKID INTEGER)
RETURNS (
    CONTENT VARCHAR(100),
    FACTORFILLING NUMERIC(5,4))
AS
declare variable QUALITYID integer;
declare variable SILAGEQUALITYID integer;
declare variable RECIPEID integer;
begin
  select SILAGEPACKS.QUALITYID, SILAGEPACKS.SILAGEQUALITYID, SILAGEPACKS.RECIPEID
    from SILAGEPACKS
    where (SILAGEPACKS.SILAGEPACKID = :SILAGEPACKID)
  into :QUALITYID, :SILAGEQUALITYID, :RECIPEID;

  execute procedure SILAGEPACKS_QUALITYCONTENT :QUALITYID, :RECIPEID returning_values :CONTENT;

  select max(coalesce(CLASS.FACTORFILLING,CROP.FACTORFILLING,1))
    from SILAGEQUALITY
      left join QUALITY on (QUALITY.QUALITYID = SILAGEQUALITY.QUALITYID)
      left join CROP on (CROP.CROPID = QUALITY.CROPID)
      left join CLASS on (CLASS.CLASSID = QUALITY.CLASSID)
    where (SILAGEQUALITY.SILAGEQUALITYID = :SILAGEQUALITYID)
  group by SILAGEQUALITY.SILAGEQUALITYID
  into :FACTORFILLING;

  suspend;
END

 

     Previous topic Chapter index Next topic