zOs/SQL/GBGRSCHH

    -- history der gbGrenzen Schwellwerte
with u as
(
  select * from oa1p.TQZ008GBGRSCHWELLE
  union all select * from oa1p.TQZ008GBGRSCHWHist
)
, v as
(
select max(date(rowBegin), validBegin) begin
    ,  min(date(rowEnd), validEnd) end
    , u.*
    from u
)
, w as
(
  select * from v where begin < end
)
select * from w
    where dbSys = 'DBOF'
    order by dbSys, db, ts, part, tsTy, dsMin, rz, begin desc
;x;
select *
    from oa1p.TQZ008GBGRSCHWELLE
      for system_time as of '2014-01-01-00.00.00'
;x;