日期:2014-05-16  浏览次数:20375 次

查询一周内的所有天数
select min_date, to_char(min_date,'day') day from
(select to_date(substr('2004-14',1,4)||'001'+rownum-1,'yyyyddd') min_date from all_tables where rownum <= decode(mod(to_number(substr('2004-14',1,4)),4),0,366,365)  
   union
   select to_date(substr('2004-14',1,4)-1|| decode(mod(to_number(substr('2004-14',1,4))-1,4),0,359,358)+rownum,'yyyyddd') min_date  from all_tables where rownum <= 7
   union
   select to_date(substr('2004-14',1,4)+1||'001'+rownum-1,'yyyyddd') min_date  from all_tables where rownum <= 7                       
)
where to_char(min_date,'yyyy-iw') ='2004-14'


http://cache.baidu.com/c?m=9f65cb4a8c8507ed4fece7631045952458438014668cc7150884c013c5234c413037bee43a634a579392613156e91a07b4ed367336092bb79dc29c0f80fbc42772c874652e4b914163c468a5dc3022d651944d9fdc0ee6cae742e0b9a1a7c82520dd2773&p=8a769a4186cc42a904fce6394649&user=baidu&fm=sc&query=oracle+%C8%D5%C6%DA%BA%AF%CA%FD&qid=80193dd404e8e0b0&p1=1