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

ADD_TO_WEIGHTNUMBER

 

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

Параметр

Тип

Описание

STORAGEID

INTEGER

 

TRANSPORTBASETYPEID

INTEGER

 

FROMINVENTORYID

INTEGER

 

DELTA

INTEGER

 

 

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

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

 

Описание

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

 

Определение

CREATE PROCEDURE ADD_TO_WEIGHTNUMBER(
    STORAGEID INTEGER,
    TRANSPORTBASETYPEID INTEGER,
    FROMINVENTORYID INTEGER,
    DELTA INTEGER)
AS
declare variable generatorname varchar(31);
declare variable itid integer;
declare variable GenOldValue bigint;
begin
 GeneratorName = 'WEIGHTNUMBERGEN' || coalesce('_ST' || Storageid,  '') 
|| coalesce('_TT' || TransportBaseTypeID, '');
 for
     select it.inventoryid, it.weightnumber from it
     left join ittransport on ittransport.inventoryid = it.inventoryid
     left join transporttype on ittransport.transporttypeid = 
transporttype.transporttypeid
     where it.storageid = :storageid and it.inventoryid >= :frominventoryid
       and (transporttype.transportsubtype = :transportbasetypeid or
           (transporttype.transportsubtype is null and 
:transportbasetypeid is null))

     into :ITID, :GenOldValue
 do
 begin
     update it set it.weightnumber = it.weightnumber + :delta
     where it.inventoryid = :itid;
 end
 Execute statement 'Set Generator '  || :GeneratorName || ' to ' || 
(GenOldValue + delta + 1);
end

 

     Previous topic Chapter index Next topic