计算一个月里面有多少工作日和一年中的工作日

select count(*) from  (
SELECT to_char(LAST_DAY(to_date('200802','yyyymm')),'dd') mdate,to_date('200802'||lpad(level,2,'0'),'yyyymmdd'), to_char(to_date('200802'||lpad(level,2,'0'),'yyyymmdd'),'W') w,to_char(to_date('200802'||lpad(level,2,'0'),'yyyymmdd'),'d') d FROM DUAL
connect by level <=to_char(LAST_DAY(to_date('200802','yyyymm')),'dd')
)
where D between 2 and 6

select count(*) from (
select  to_char(to_date('20080101','yyyymmdd')+rownum-1,'d') d,to_date('20080101','yyyymmdd')+rownum-1,
rownum
from dual
connect by rownum <= to_date('2008','yyyy')-to_date('2007','yyyy')
)
where d between 2 and 6

 

 

 

你可能感兴趣的:(Oracle)