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

ACN_COMESELECT_R

 

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

Параметр

Тип

Описание

ARECORDID

INTEGER

 

BEGINTIME

TIMESTAMP

 

ENDTIME

TIMESTAMP

 

 

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

Параметр

Тип

Описание

TMPTABID

INTEGER

 

CREATERECDATE

TIMESTAMP

 

CREATEUSER

VARCHAR(50)

 

NET

INTEGER

 

NETDATE

TIMESTAMP

 

NETUSER

VARCHAR(50)

 

REGDATE

DATE

 

SQDATE

TIMESTAMP

 

SQUSER

VARCHAR(50)

 

LQDATE

TIMESTAMP

 

LQUSER

VARCHAR(50)

 

DELDATE

TIMESTAMP

 

DELUSER

VARCHAR(50)

 

LASTPREV

INTEGER

 

HUMIDITY

NUMERIC(9,2)

 

GRAINUNIT

INTEGER

 

DIRT

NUMERIC(9,2)

 

SCREENING

NUMERIC(9,2)

 

OILSEED

NUMERIC(9,2)

 

PROTEIN

NUMERIC(9,2)

 

GLUTEN

NUMERIC(9,1)

 

GLUTENQUALITY

INTEGER

 

DROPNUMBER

INTEGER

 

ACIDITY

NUMERIC(9,2)

 

GLASSNESS

INTEGER

 

 

Описание

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

 

Определение

CREATE PROCEDURE ACN_COMESELECT_R(
    ARECORDID INTEGER,
    BEGINTIME TIMESTAMP,
    ENDTIME TIMESTAMP)
RETURNS (
    TMPTABID INTEGER,
    CREATERECDATE TIMESTAMP,
    CREATEUSER VARCHAR(50),
    NET INTEGER,
    NETDATE TIMESTAMP,
    NETUSER VARCHAR(50),
    REGDATE DATE,
    SQDATE TIMESTAMP,
    SQUSER VARCHAR(50),
    LQDATE TIMESTAMP,
    LQUSER VARCHAR(50),
    DELDATE TIMESTAMP,
    DELUSER VARCHAR(50),
    LASTPREV INTEGER,
    HUMIDITY NUMERIC(9,2),
    GRAINUNIT INTEGER,
    DIRT NUMERIC(9,2),
    SCREENING NUMERIC(9,2),
    OILSEED NUMERIC(9,2),
    PROTEIN NUMERIC(9,2),
    GLUTEN NUMERIC(9,1),
    GLUTENQUALITY INTEGER,
    DROPNUMBER INTEGER,
    ACIDITY NUMERIC(9,2),
    GLASSNESS INTEGER)
AS
declare variable TMPDATE timestamp;
declare variable TMPUSER varchar(50);
declare variable LASTDATE timestamp;
declare variable TMP2TABID integer;
begin
/*
  select first 1
    ilt_prev.TABLEOPERATIONID,
    ilt_prev.CREATETIME
  from ilt$tableoperation ilt_prev
    left join ilt$fieldinteger fi on (ilt_prev.TABLEOPERATIONID = fi.TABLEOPERATIONID
     and (fi.FIELDID in (13,29,30) or (fi.FIELDID = 44 and fi.FIELDVALUE = -1)) )
    left join ilt$fielddate fd on (ilt_prev.TABLEOPERATIONID = fd.TABLEOPERATIONID
     and fd.FIELDID = 3)
  where ilt_prev.RECORDID = :ARECORDID
   and ilt_prev.CREATETIME < :BEGINTIME
   and ilt_prev.TABLEID = 149
   and ((fi.FIELDID = 44 and fi.FIELDVALUE = -1)
         or (fi.FIELDID in (13,29,30))
         or (fd.FIELDID = 3) )
  order by ilt_prev.CREATETIME desc
  INTO :lastprev,
       :LastDate;
--*/
  for
    select ILT1.TABLEOPERATIONID, USERS_SHORTNAME.USERSHORTNAME, ILT1.CREATETIME
      from ILT$TABLEOPERATION ILT1
        left join ILT$FIELDINTEGER FILI on ((ILT1.TABLEOPERATIONID = FILI.TABLEOPERATIONID)
          and ((FILI.FIELDID in (13,29,30)) or ((FILI.FIELDID = 44) and (FILI.FIELDVALUE = -1))))
        left join ILT$FIELDDATE FIL on ((ILT1.TABLEOPERATIONID = FIL.TABLEOPERATIONID) and (FIL.FIELDID = 3))
        left join USERS_SHORTNAME(ILT1.USERID) on (0=0)
      where ((ILT1.CREATETIME = :LASTDATE) and (ILT1.TABLEOPERATIONID = :LASTPREV))
        or ((ILT1.TABLEID = 149) and (ILT1.RECORDID = :ARECORDID)
            and (ILT1.CREATETIME between :BEGINTIME and :ENDTIME)
            and ((FIL.FIELDID = 3) or (FILI.FIELDID in (13,29,30))
                 or ((FILI.FIELDID = 44) and (FILI.FIELDVALUE = -1))))
    group by ILT1.TABLEOPERATIONID, ILT1.CREATETIME, USERS_SHORTNAME.USERSHORTNAME
    into :TMPTABID, :TMPUSER,:TMPDATE

  do begin
    select cast(:TMPTABID as integer),  ACN_COMESELECT_S.CREATERECDATE,  ACN_COMESELECT_S.CREATEUSER,
        ACN_COMESELECT_S.NET, ACN_COMESELECT_S.NETDATE, ACN_COMESELECT_S.NETUSER,
        ACN_COMESELECT_S.SQDATE, ACN_COMESELECT_S.SQUSER, ACN_COMESELECT_S.DELDATE,
        ACN_COMESELECT_S.DELUSER, ACN_COMESELECT_S.REGDATE, ACN_COMESELECT_S.LQDATE,
        ACN_COMESELECT_S.LQUSER, ACN_COMESELECT_S.HUMIDITY, ACN_COMESELECT_S.GRAINUNIT,
        ACN_COMESELECT_S.DIRT, ACN_COMESELECT_S.SCREENING, ACN_COMESELECT_S.OILSEED,
        ACN_COMESELECT_S.PROTEIN, ACN_COMESELECT_S.GLUTEN, ACN_COMESELECT_S.GLUTENQUALITY,
        ACN_COMESELECT_S.DROPNUMBER, ACN_COMESELECT_S.ACIDITY, ACN_COMESELECT_S.GLASSNESS
      from ACN_COMESELECT_S(:ARECORDID, :TMPTABID, :TMPUSER,:TMPDATE)
    group by 1, ACN_COMESELECT_S.CREATERECDATE, ACN_COMESELECT_S.CREATEUSER, ACN_COMESELECT_S.NET,
        ACN_COMESELECT_S.NETDATE, ACN_COMESELECT_S.NETUSER, ACN_COMESELECT_S.SQDATE,
        ACN_COMESELECT_S.SQUSER, ACN_COMESELECT_S.DELDATE, ACN_COMESELECT_S.DELUSER,
        ACN_COMESELECT_S.REGDATE, ACN_COMESELECT_S.LQDATE, ACN_COMESELECT_S.LQUSER,
        ACN_COMESELECT_S.HUMIDITY, ACN_COMESELECT_S.GRAINUNIT, ACN_COMESELECT_S.DIRT,
        ACN_COMESELECT_S.SCREENING, ACN_COMESELECT_S.OILSEED, ACN_COMESELECT_S.PROTEIN,
        ACN_COMESELECT_S.GLUTEN, ACN_COMESELECT_S.GLUTENQUALITY, ACN_COMESELECT_S.DROPNUMBER,
        ACN_COMESELECT_S.ACIDITY, ACN_COMESELECT_S.GLASSNESS
    into :TMP2TABID, :CREATERECDATE, :CREATEUSER, :NET, :NETDATE, :NETUSER,
         :SQDATE, :SQUSER, :DELDATE, :DELUSER, :REGDATE, :LQDATE, :LQUSER,
         :HUMIDITY, :GRAINUNIT, :DIRT, :SCREENING, :OILSEED, :PROTEIN,
         :GLUTEN, :GLUTENQUALITY, :DROPNUMBER, :ACIDITY, :GLASSNESS;
    
    suspend;
  end --*/
end

 

     Previous topic Chapter index Next topic