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

IT_GETGENERATOR_WEIGHTNUMBER

 

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

Параметр

Тип

Описание

TRANSPORTTYPEID

INTEGER

 

STORAGEID

INTEGER

 

AUTOCREATE

INTEGER

 

 

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

Параметр

Тип

Описание

GENERATORNAME

VARCHAR(31)

 

 

Описание

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

 

Определение

CREATE PROCEDURE IT_GETGENERATOR_WEIGHTNUMBER(
    TRANSPORTTYPEID INTEGER,
    STORAGEID INTEGER,
    AUTOCREATE INTEGER)
RETURNS (
    GENERATORNAME VARCHAR(31))
AS
declare variable STARTGENVALUE integer;
begin

--  if (/*(TRANSPORTTYPEID is not null) or */(STORAGEID is not null)) then begin
  if (STORAGEID is not null) then begin
    GENERATORNAME = 'WEIGHTNUMBERGEN' || coalesce('_ST' || STORAGEID,  '') || coalesce('_TT' || TRANSPORTTYPEID, '');
    if (not exists (select * from rdb$generators where rdb$generators.rdb$generator_name = :GENERATORNAME)) then begin
      if (AUTOCREATE <> 1) then
        GENERATORNAME = null;
      else execute statement 'create generator ' || :GENERATORNAME;
/*
      STARTGENVALUE = substring(extract (YEAR from current_date) from 3 for 2) * 1000000 +
                      Coalesce(STORAGEID, 0) * 100000;
      execute statement 'set generator '  || :GENERATORNAME || ' to ' || :STARTGENVALUE;
*/
    end
  end

  if (:GENERATORNAME is null) then
    GENERATORNAME = 'WEIGHTNUMBERGEN';

  suspend;

end

 

     Previous topic Chapter index Next topic