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

QUALITY_CROPFULLNAME

 

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

Параметр

Тип

Описание

CROPID

INTEGER

 

CLASSID

INTEGER

 

SORTID

INTEGER

 

USEFULLNAMES

SMALLINT

 

 

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

Параметр

Тип

Описание

CROPFULLNAME

VARCHAR(150)

 

CODE_KULTURA

VARCHAR(10)

 

 

Описание

Полное имя культуры с классом и сортом

 

Определение

CREATE PROCEDURE QUALITY_CROPFULLNAME(
    CROPID INTEGER,
    CLASSID INTEGER,
    SORTID INTEGER,
    USEFULLNAMES SMALLINT)
RETURNS (
    CROPFULLNAME VARCHAR(150),
    CODE_KULTURA VARCHAR(10))
AS
declare variable TMPNAME varchar(31);
begin
  CROPFULLNAME = '';

  if (CROPID is not null) then begin
    select
        case :USEFULLNAMES
          when 1 then
            CROP.CROPNAME
          else CROP.SHORTCROPNAME
        end
      from CROP
      where (CROP.CROPID = :CROPID)
    into :TMPNAME;

    if (not TMPNAME is  null) then
      CROPFULLNAME = CROPFULLNAME || TMPNAME;
  end

  TMPNAME = null;

  if (CLASSID is not null) then begin
    select
        case :USEFULLNAMES
          when 1 then
            CLASS.CLASSNAME
          else CLASS.SHORTCLASSNAME
        end,
        CLASS.CODE_KULTURA
      from CLASS
      where (CLASS.CLASSID = :CLASSID)
    into :TMPNAME, :CODE_KULTURA;

    if (not TMPNAME is null) then
      CROPFULLNAME = CROPFULLNAME || ' ' || TMPNAME;
  end

  TMPNAME = null;

  if (SORTID is not null) then begin
    select
        case :USEFULLNAMES
          when 1 then
            CROPSORT.SORTNAME
          else CROPSORT.SORTSHORTNAME
        end
      from CROPSORT
      where (CROPSORT.SORTID = :SORTID)
    into :TMPNAME;

    if (not TMPNAME is null) then
      CROPFULLNAME = CROPFULLNAME || ' ' || TMPNAME;
  end

  suspend;
END

 

     Previous topic Chapter index Next topic