Входные параметры
Параметр | Тип | Описание |
---|---|---|
QUALITYID |
INTEGER |
|
Выходные параметры
Параметр | Тип | Описание |
---|---|---|
COPYQUALITYID |
INTEGER |
|
Описание
Копирование качества
Определение
CREATE PROCEDURE QUALITY_COPY(
QUALITYID INTEGER)
RETURNS (
COPYQUALITYID INTEGER)
AS
declare variable QTYPEID integer;
declare variable QVALUE numeric(9,2);
declare variable CROPID integer;
declare variable CLASSID integer;
declare variable SORTID integer;
declare variable ANALYSISDATE date;
declare variable SAMPLINGDATE date;
begin
if (not exists (select QUALITYID from QUALITY where QUALITYID = :QUALITYID)) then
COPYQUALITYID = null;
else begin
COPYQUALITYID = gen_id(QUALITYIDGEN, 1);
select CROPID, CLASSID, SORTID, ANALYSISDATE, SAMPLINGDATE
from QUALITY
where (QUALITY.QUALITYID = :QUALITYID)
into :CROPID, :CLASSID, :SORTID, :ANALYSISDATE, :SAMPLINGDATE;
insert into QUALITY(QUALITYID, CROPID, CLASSID, SORTID, ANALYSISDATE, SAMPLINGDATE)
values(:COPYQUALITYID, :CROPID, :CLASSID, :SORTID, :ANALYSISDATE, :SAMPLINGDATE);
for
select QUALITYDATA.QUALITYTYPEID, QUALITYDATA.QUALITYVALUE
from QUALITYDATA
where (QUALITYDATA.QUALITYID = :QUALITYID)
into :QTYPEID, :QVALUE
do
insert into QUALITYDATA(QUALITYID, QUALITYTYPEID, QUALITYVALUE)
values(:COPYQUALITYID, :QTYPEID, :QVALUE);
end
suspend;
end