
WK WK_FROM WK_TO DAY_1 DAY_2 DAY_3 DAY_4 DAY_5 DAY_6 DAY_7Īnd a further example, just in case you wanted a calendar. This should give you a pointer in the right direction.Ĥ ,max(case when to_char(wk_from+rn,'D') = '1' and wk_from+rn last_day(dt) thenġ8 from (select to_date(dt,'MM/YYYY') as dtġ9 ,to_number(to_char(to_date(dt,'MM/YYYY'),'D')) as offsetĢ1 ,(select rownum-1 rn from dual connect by rownum / SQL>So if you want all the days for a week, how do you want the output to appear?
#ORACLE SQL WEEK NUMBER FULL#
Well, here's the full output from your initial requirement.ġ WITH mydate as (select '10/2008' as dt from dual)Ĥ, dt+(decode(rn,0,0,(7*rn)+1-offset)) as wk_fromĥ, case when dt+(7*(rn+1))-offset > last_day(dt) thenġ0 from (select to_date(dt,'MM/YYYY') as dtġ1 ,to_number(to_char(to_date(dt,'MM/YYYY'),'D')) as offsetġ3 ,(select rownum-1 rn from dual connect by rownum / What I still need are the days of a week. 1.7K Training / Learning / Certification.165.3K Java EE (Java Enterprise Edition).


7.9K Oracle Database Express Edition (XE).

