1 2 3 4 5 6 7 8 9 10 11 12 13 14
| select DATDEB + level - 1 date_val, matri, datdeb, datfin, to_char(DATDEB + level - 1, 'day') jour, FERIPONT
from
(
select t.matri, t.datdeb, t.datfin, rownum rn,TABS.DAT as DTE,
CASE WHEN TABS.MOTIF in ('FERI', 'PONTCP') then 1 end as FERIPONT
from t, TABS
where TABS.MATRI= t.MATRI
t.matri = '003269' and t.motif = 'present' AND t.datdeb between to_date('01012023', 'ddmmyyyy') and to_date('31012023','ddmmyyyy')
)
WHERE DTE = DATDEB + level - 1
AND ((FERIPONT = 1) OR (to_char(DATDEB + level - 1, 'D', 'NLS_DATE_LANGUAGE=french') in ('7','6'))
connect by level <= DATFIN - DATDEB + 1
and prior rn = rn
and prior sys_guid() is not null; |
Partager