Что-то вроде этого?
with test (col) as
(select '09/2020' from dual),
-- construct the whole year with week markers
whole_year as
(select to_date(substr(col, -4), 'yyyy') + level - 1 datum,
--
to_char(to_date(substr(col, -4), 'yyyy') + level - 1, 'ww') week
from test
connect by level <= add_months(to_date(substr(col, -4), 'yyyy'), 12) -
to_date(substr(col, -4), 'yyyy')
)
select min(datum)
from whole_year
where week = '09';
whole_year
CTE - для недели 09 - выглядит так:
DATUM WE
---------- --
25.02.2020 08
26.02.2020 09 --> this
27.02.2020 09
28.02.2020 09
29.02.2020 09
01.03.2020 09
02.03.2020 09
03.03.2020 09
04.03.2020 10
05.03.2020 10
06.03.2020 10
, что означает, что запрос, который я разместил выше, в результате , возвращает
<snip>
12 select min(datum)
13 from whole_year
14 where week = '09';
MIN(DATUM)
----------
26.02.2020
SQL>