oracle查年度周末日期

 

1.查年度周末日期sql

SELECT distinct
 TRUNC(TO_DATE('2019-01-01','yyyy-mm-dd')+ rownum,'iw')+ 5 AS sat,
 TRUNC(TO_DATE('2019-01-01','yyyy-mm-dd')+ rownum,'iw')+ 6 AS sun
FROM
 dual
 where instr(to_char(sat),'2020')=0
 AND instr(to_char(sun),'2020')=0
CONNECT BY
 rownum <=(TO_DATE('2019-12-31','yyyy-mm-dd')-TO_DATE('2019-01-01','yyyy-mm-dd')) 
 ORDER BY sat,sun;

posted @ 2020-09-08 15:37  orcl  阅读(1102)  评论(0编辑  收藏  举报