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!

Have to calculate number of working days

800528Jul 11 2012 — edited Jul 12 2012
hi,

have a function using this function i have to calculate the work days

the functions is

CREATE OR REPLACE FUNCTION XXXXXXXXXXX (
pdate IN DATE
, pdays IN NUMBER
)
RETURN DATE
AS
CURSOR c
IS
SELECT calendar_date
, ROWNUM
FROM bom_calendar_dates
WHERE calendar_code = 'DEP CAL'
AND TO_CHAR (calendar_date, 'YYYY') = TO_CHAR (pdate, 'YYYY')
AND seq_num IS NOT NULL
AND TO_CHAR (calendar_date, 'DY') NOT IN ('SAT', 'SUN')
AND calendar_date <= TRUNC (pdate)
ORDER BY 1 DESC;
BEGIN
IF TO_CHAR (pdate, 'DY') NOT IN ('SAT', 'SUN')
THEN
FOR i IN c
LOOP
IF i.ROWNUM = pdays
THEN
RETURN (i.calendar_date);
END IF;
END LOOP;
END IF;
END;


use this logic have get the number of working day
which we will be used in the package which procedure a xls report ...

thanks in advance...
please help in regard....
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 9 2012
Added on Jul 11 2012
6 comments
846 views