Входные параметры
Параметр | Тип | Описание |
---|---|---|
QUALITYID |
INTEGER |
|
CROPID |
INTEGER |
|
CLASSID |
INTEGER |
|
SORTID |
INTEGER |
|
ANALYSISDATE |
DATE |
|
QUALITYNUMBER |
INTEGER |
|
HUMIDITY |
NUMERIC(9,2) |
|
GLUTEN |
NUMERIC(9,1) |
|
GLUTENQUALITY |
INTEGER |
|
HARVESTYEAR |
INTEGER |
|
GRAINUNIT |
INTEGER |
|
ASH |
NUMERIC(9,2) |
|
GLASSNESS |
INTEGER |
|
DIRT |
NUMERIC(9,2) |
|
SCREENING |
NUMERIC(9,2) |
|
POISON |
NUMERIC(9,2) |
|
SMALLGRAIN |
NUMERIC(9,2) |
|
REGIONID |
INTEGER |
|
DROPNUMBER |
INTEGER |
|
INFRALUMGLUTEN |
INTEGER |
|
Выходные параметры
Параметр | Тип | Описание |
---|---|---|
RESULTQUALITYID |
INTEGER |
|
Описание
Вставка качества
Определение
CREATE PROCEDURE QUALITY_INSERT(
QUALITYID INTEGER,
CROPID INTEGER,
CLASSID INTEGER,
SORTID INTEGER,
ANALYSISDATE DATE,
QUALITYNUMBER INTEGER,
HUMIDITY NUMERIC(9,2),
GLUTEN NUMERIC(9,1),
GLUTENQUALITY INTEGER,
HARVESTYEAR INTEGER,
GRAINUNIT INTEGER,
ASH NUMERIC(9,2),
GLASSNESS INTEGER,
DIRT NUMERIC(9,2),
SCREENING NUMERIC(9,2),
POISON NUMERIC(9,2),
SMALLGRAIN NUMERIC(9,2),
REGIONID INTEGER,
DROPNUMBER INTEGER,
INFRALUMGLUTEN INTEGER)
RETURNS (
RESULTQUALITYID INTEGER)
AS
begin
if (:QUALITYID is null) then
RESULTQUALITYID = gen_id(QUALITYIDGEN,1);
else RESULTQUALITYID = :QUALITYID;
if ((:CROPID is not null) or (:CLASSID is not null) or (:SORTID is not null) or (:ANALYSISDATE is not null)) then
insert into QUALITY (QUALITYID, CROPID, CLASSID, SORTID, ANALYSISDATE)
values (:RESULTQUALITYID, :CROPID, :CLASSID, :SORTID, :ANALYSISDATE);
if (:QUALITYNUMBER is not null) then
insert into QUALITYDATA (QUALITYID, QUALITYTYPEID, QUALITYVALUE)
values (:RESULTQUALITYID, 1, :QUALITYNUMBER);
if (:HUMIDITY is not null) then
insert into QUALITYDATA (QUALITYID, QUALITYTYPEID, QUALITYVALUE)
values (:RESULTQUALITYID, 2, :HUMIDITY);
if (:GLUTEN is not null) then
insert into QUALITYDATA (QUALITYID, QUALITYTYPEID, QUALITYVALUE)
values (:RESULTQUALITYID, 3, :GLUTEN);
if (:GLUTENQUALITY is not null) then
insert into QUALITYDATA (QUALITYID, QUALITYTYPEID, QUALITYVALUE)
values (:RESULTQUALITYID, 4, :GLUTENQUALITY);
if (:HARVESTYEAR is not null) then
insert into QUALITYDATA (QUALITYID, QUALITYTYPEID, QUALITYVALUE)
values (:RESULTQUALITYID, 6, :HARVESTYEAR);
if (:GRAINUNIT is not null) then
insert into QUALITYDATA (QUALITYID, QUALITYTYPEID, QUALITYVALUE)
values (:RESULTQUALITYID, 7, :GRAINUNIT);
if (:ASH is not null) then
insert into QUALITYDATA (QUALITYID, QUALITYTYPEID, QUALITYVALUE)
values (:RESULTQUALITYID, 11, :ASH);
if (:GLASSNESS is not null) then
insert into QUALITYDATA (QUALITYID, QUALITYTYPEID, QUALITYVALUE)
values (:RESULTQUALITYID, 12, :GLASSNESS);
if (:DIRT is not null) then
insert into QUALITYDATA (QUALITYID, QUALITYTYPEID, QUALITYVALUE)
values (:RESULTQUALITYID, 13, :DIRT);
if (:SCREENING is not null) then
insert into QUALITYDATA (QUALITYID, QUALITYTYPEID, QUALITYVALUE)
values (:RESULTQUALITYID, 14, :SCREENING);
if (:DROPNUMBER is not null) then
insert into QUALITYDATA (QUALITYID, QUALITYTYPEID, QUALITYVALUE)
values (:RESULTQUALITYID, 59, :DROPNUMBER);
if (:POISON is not null) then
insert into QUALITYDATA (QUALITYID, QUALITYTYPEID, QUALITYVALUE)
values (:RESULTQUALITYID, 15, :POISON);
if (:SMALLGRAIN is not null) then
insert into QUALITYDATA (QUALITYID, QUALITYTYPEID, QUALITYVALUE)
values (:RESULTQUALITYID, 16, :SMALLGRAIN);
if (:REGIONID is not null) then
insert into QUALITYDATA (QUALITYID, QUALITYTYPEID, QUALITYVALUE)
values (:RESULTQUALITYID, 18, :REGIONID);
if (:INFRALUMGLUTEN is not null) then
insert into QUALITYDATA (QUALITYID, QUALITYTYPEID, QUALITYVALUE)
values (:RESULTQUALITYID, 87, :INFRALUMGLUTEN);
suspend;
end