Home » SQL & PL/SQL » SQL & PL/SQL » Regarding business days calculation
Regarding business days calculation [message #188894] Tue, 22 August 2006 05:12 Go to next message
keerthi m
Messages: 1
Registered: August 2006
Location: hyd
Junior Member
Hi all,
I need to write a function which should take in start date and end date as parameters and should return no of working days.Here i need to exclude holidays(sundays and only second saturdays )if any, in the range of the dates which i have entered, and should return the count of only working days.
please help.

Thanks in advance,
keerthi.
Re: Regarding business days calculation [message #188903 is a reply to message #188894] Tue, 22 August 2006 06:02 Go to previous message
gold_oracl
Messages: 129
Registered: July 2006
Location: Westborough, MA
Senior Member
You can use this query itself to count the no. of working days excluding only second saturday and sunday

SELECT SUM(DECODE(TO_CHAR(TO_DATE('&1','YYYYMMDD')+LEVEL-1,'DY'),'SUN',0,'SAT',DECODE(TO_CHAR(TO_DATE('&1','YYYYMMDD')+LEVEL-1,'W'),2,0,1),1)) FROM DUAL CONNECT BY LEVEL <=(TO_DATE('&2','YYYYMMDD')-TO_DATE('&1','YYYYMMDD'))+1;

Thanks,
Thangam
Previous Topic: Executing a stored procedure
Next Topic: test suite of oracle statements for a parser
Goto Forum:
  


Current Time: Sat Dec 03 18:16:24 CST 2016

Total time taken to generate the page: 0.07222 seconds