select
the_week,
sunday,
saturday,
to_char(sunday,‘yyyyMMdd‘)||‘-‘||to_char(saturday,‘yyyyMMdd‘) week_desc
from (select sunday.the_week,
decode(sign(sunday.the_day - saturday.the_day),
-1,
sunday.the_day,
sunday.the_day - 7) sunday,
saturday.the_day saturday
from ( select decode(to_char(wwm,‘yyyy/mm/dd‘),‘2014/01/01‘,‘1‘,to_char(wwm, ‘WW‘)+1) the_week,
to_char(wwm, ‘D‘) the_daynum,
wwm the_day
from (select trunc(to_date(‘2014-01-01‘, ‘yyyy-mm-dd‘), ‘MM‘) + rownum - 1 as wwm
from user_objects
where rownum < 366)
where to_char(wwm, ‘D‘) = 1 or to_char(wwm,‘yyyy/mm/dd‘)=‘2014/01/01‘) sunday,
( select to_char(wwm, ‘WW‘)+0 the_week,
to_char(wwm, ‘D‘) the_daynum,
wwm the_day
from (select trunc(to_date(‘2014-01-01‘, ‘yyyy-mm-dd‘), ‘MM‘) + rownum - 1 as wwm
from user_objects
where rownum < 366)
where to_char(wwm, ‘D‘) = 7 or to_char(wwm,‘yyyy/mm/dd‘)=‘2014/12/31‘) saturday
where sunday.the_week = saturday.the_week)
where THE_WEEK=?
相关文章
- 09-04根据日期类型字段获取年、季度、周(SQLSERVER)
- 09-04python获取本天,本周,本月,本年,上一天,上一周,上一月,上一年的开始及结束日期
- 09-04获取某月份第N周结束日期(即星期日)
- 09-04获取某月份第N周开始日期(即星期一)
- 09-04java获取本月开始时间和结束时间、上个月第一天和最后一天的时间以及当前日期往前推一周、一个月
- 09-04php 计算指定年份的周总数与及第几周的开始日期和结束日期(从周一开始)
- 09-04PHP计算一年有多少周,每周开始日期和结束日期
- 09-04Oracle获取一周前,一个月前,一年前, 本周,本月,当年的日期
- 09-04转:Oracle日期周详解以及周开始结束时间计算
- 09-04php获取一年中某一周的开始和结束时间