1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| SELECT
greatest(trunc(to_date(y||'-01-01','RRRR-MM-DD'),'IW')+(
Case When
trim(to_char(to_date(y||'-01-01','RRRR-MM-DD'),'Day','nls_date_language=french')) NOT IN ('Samedi', 'Dimanche')
Then
w
Else
w +1
End -1)*7,trunc(to_date(y||'-01-01','RRRR-MM-DD'),'IW')) AS "Lundi"
, trunc(to_date(y||'-01-01','RRRR-MM-DD'),'IW')+6+(
Case When
trim(to_char(to_date(y||'-01-01','RRRR-MM-DD'),'Day','nls_date_language=french')) NOT IN ('Samedi', 'Dimanche')
Then
w
Else
w +1
End -1)*7 AS "Dimanche"
FROM
(SELECT &year y, &week w FROM dual) ; |
Partager