with tmp as (select
date '2016-12-31' d
from dual
)
select * from
(
select r, wn,
sum(decode(wn, 1, 1, 0))over(order by rownum) + decode(to_char(trunc(d, 'y') - 1, 'd'),1,1,1) nthweek
from (select trunc(d, 'y') + rownum - 1 r, d,
to_char(trunc(d, 'y') + rownum , 'd') - 1 wn
from tmp
connect by rownum <= d - trunc(d, 'y') + 1
)
) z
where z.r = date '2016-12-31'