Skip to Main Content

Analytics Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Function to count weekdays between two dates?

t_norwilloAug 28 2007 — edited Sep 21 2007

Is there a function I can use in Discoverer to get a count of the weekdays between two dates? I've found an sql solution to get weekdays for the current year but I can't quite figure out how to adapt it to my needs.

solution to get weekdays posted on Metalink:

select count(*)
from ( select trunc(sysdate,'year')+rnum-1
from ( select rownum rnum
from all_objects
where rownum <= to_char(sysdate,'ddd') )
where to_char( trunc(sysdate,'year')+rnum-1, 'd' ) not in ( '1', '7' );

What I have so far:

creation_date

and

attribute10

are my two dates

select count(*) 
from all_objects
where rownum <= (select to_char(creation_date,'ddd')-to_char(to_date(attribute10,'YYYY/MM/DD HH24:MI:SS'),'ddd')
                 from aso_quote_headers_v where quote_header_id = 7313)

-->this returns 14 days which is the total number of days but I need to incorporate a check for weekdays

and to_char(trunc(<date>,'year'),'d') not in ('1', '7')

Is there an easier way to do this?

Discoverer v 4.1.48
Database v 9i

-Tracy

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 19 2007
Added on Aug 28 2007
9 comments
4,100 views