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 fullWell, 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.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |