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

QUALITY_COPY_ONLYDATA

 

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

Параметр

Тип

Описание

QUALITYID

INTEGER

 

COPYQUALITYID

INTEGER

 

 

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

Параметр

Тип

Описание

RESULTQUALITYID

INTEGER

 

 

Описание

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

 

Определение

CREATE PROCEDURE QUALITY_COPY_ONLYDATA(
    QUALITYID INTEGER,
    COPYQUALITYID INTEGER)
RETURNS (
    RESULTQUALITYID INTEGER)
AS
declare variable QTYPEID integer;
declare variable QVALUE numeric(9,2);
begin
  if (COPYQUALITYID is null) then
    COPYQUALITYID = gen_id(QUALITYIDGEN, 1);

  for
    select QUALITYDATA.QUALITYTYPEID, QUALITYDATA.QUALITYVALUE
      from QUALITYDATA
      where (QUALITYDATA.QUALITYID = :QUALITYID)
    into :QTYPEID, :QVALUE
  do begin
    update QUALITYDATA
    set QUALITYVALUE = :QVALUE
    where ((QUALITYID = :COPYQUALITYID) and (QUALITYTYPEID = :QTYPEID));

    if (row_count = 0) then
      insert into QUALITYDATA(QUALITYID, QUALITYTYPEID, QUALITYVALUE)
        values (:COPYQUALITYID, :QTYPEID, :QVALUE);
  end

  RESULTQUALITYID = :COPYQUALITYID;
  suspend;
END

 

     Previous topic Chapter index Next topic