Skip to Main Content

SQL & PL/SQL

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!

Working days

665268Mar 25 2009 — edited Mar 25 2009
I am calculate working days. So i first find number of weeks in a month. This my query.

DECLARE @theYear SMALLINT
DECLARE @theMonth SMALLINT
SET @theYear = ?Year? //*Year parameter
SET @theMonth=?Period? //*month parameter

SELECT theMonth,
(theLast - theFirst + 1) * 5 AS theWeeks
FROM (
SELECT @theMonth AS theMonth,
datediff(day,-1,dateadd(month,((@theyear-1900)*12)+@theMonth,0))/7 AS theFirst,
datediff(day,-1,dateadd(month,((@theyear-1900)*12)+@theMonth,30))/7 AS theLast
FROM OAS_docline
WHERE @theMonth < 12
) AS d

Please help me how to calculate working days in a month.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 22 2009
Added on Mar 25 2009
4 comments
302 views