Monday, July 11, 2011

SQL: Number of working days in a month

select count(*)
from(
select trunc(sysdate,'month')+rownum-1 dy
from all_objects
where rownum <= last_day(sysdate) - trunc(sysdate,'month')+1)
where to_char(dy,'fmday') not in ('sunday','saturday');


Until Next Post... :)

No comments:

Post a Comment