Входные параметры
Параметр | Тип | Описание |
---|---|---|
ISCURRENT |
INTEGER |
|
PARTYDATE |
DATE |
|
CROPID |
INTEGER |
|
CLASSID |
INTEGER |
|
STORAGEID |
INTEGER |
|
Выходные параметры
Параметр | Тип | Описание |
---|---|---|
PARTYID |
INTEGER |
|
Описание
(Нет описания для процедуры GETPARTYID)
Определение
CREATE PROCEDURE GETPARTYID(
ISCURRENT INTEGER,
PARTYDATE DATE,
CROPID INTEGER,
CLASSID INTEGER,
STORAGEID INTEGER)
RETURNS (
PARTYID INTEGER)
AS
begin
if (:ISCURRENT = 1) then
select PARTIES.PARTYID
from PARTIES
where (PARTIES.STATE = 1)
and ((PARTIES.STORAGEID = :STORAGEID) and (PARTIES.CROPID = :CROPID) and (PARTIES.CLASSID = :CLASSID))
into:PARTYID;
else
select PARTIES.PARTYID
from PARTIES
where (:PARTYDATE between PARTIES.BEGINDATE and coalesce(PARTIES.ENDDATE, current_date))
and ((PARTIES.STORAGEID = :STORAGEID) and (PARTIES.CROPID = :CROPID) and (PARTIES.CLASSID = :CLASSID))
into :PARTYID;
if (:PARTYID is null) then begin
if (:ISCURRENT = 1) then
select PARTIES.PARTYID
from PARTIES
where (PARTIES.STATE = 1)
and ((PARTIES.STORAGEID = :STORAGEID) and (PARTIES.CROPID = :CROPID) and (PARTIES.CLASSID is null))
into :PARTYID;
else
select PARTIES.PARTYID
from PARTIES
where (:PARTYDATE between PARTIES.BEGINDATE and coalesce(PARTIES.ENDDATE,current_date))
and ((PARTIES.STORAGEID = :STORAGEID) and (PARTIES.CROPID = :CROPID) and (PARTIES.CLASSID is null))
into :PARTYID;
if (:PARTYID is null) then
PARTYID = -1;
end
suspend;
end