Запрсы на доступ на холде более 5 календарных дней
select
GRFNMWRTINST.EXTERNAL_KEY_DIS as ReqNo,
GRFNMWRTINST.APPROVAL_STATUS as STATUS,
to_char(to_date(substr(replace(GRFNMWRTINST.LAST_UPDATED_AT, '.', ''),1, 8), 'YYYYMMDD'), 'DD.MM.YYYY') as LAST_UPDATED_AT,
GRFNMWRTINST.ON_HOLD_BY as HOLD_BY
from GRFNMWRTINST
where GRFNMWRTINST.INSTANCE_STATUS = 'RUNNING'
and GRFNMWRTINST.LAST_UPDATED_AT is not null
and substr(replace(GRFNMWRTINST.LAST_UPDATED_AT, '.', ''),1, 8) < to_char(SYSDATE - 5, 'YYYYMMDD')
and (GRFNMWRTINST.ON_HOLD_BY in
('EKOMOGORO00', 'PKAZMIN00', 'LMAKHMURI01', 'AVISHNYAK00',
'YAKMULLIN00', 'GYAMILOVA00', 'ITEMCHUK00', 'ASHISHLY00')
OR
GRFNMWRTINST.ON_HOLD_BY in
('VEVTEEV00', 'ANPOPOV00', 'YMAVLYUTO00', 'PKOKOUROV00',
'VEVTEEV01', 'AKULAKOV05', 'ANOVIKOVA02','SUMANSKY00',
'EDROZD03', 'LMAKHMURI00', 'ANTARASO00'))
order by substr(replace(GRFNMWRTINST.LAST_UPDATED_AT, '.', ''),1, 8), HOLD_BY, ReqNo