CREATE OR REPLACE FUNCTION totworkdays (fromdate DATE, todate DATE)
RETURN NUMBER
IS
totalsundays NUMBER;
totalsaturdays NUMBER;
BEGIN
totalsundays :=
NEXT_DAY (todate - 7, 'sunday') - NEXT_DAY (fromdate - 1, 'sunday');
totalsaturdays :=
NEXT_DAY (todate - 7, 'saturday') - NEXT_DAY (fromdate - 1, 'saturday');
RETURN (todate - fromdate - (totalsundays + totalsaturdays) / 7 - 1);
END totworkdays;
CALL this function as follows:
declare
lv_tot_work_days number;
BEGIN
lv_tot_work_days := totworkdays ('01-jan-2009', '31-jan-2009');
DBMS_OUTPUT.put_line ('Total Work Days: ' || lv_tot_work_days);
END;
Join the OracleApps88 Telegram group @OracleApps88to get more information on Oracle EBS R12/Oracle Fusion applications.
If you are facing any issues while copying the Code/Script or any issues with Posts, Please send a mail to OracleApp88@Yahoo.com or message me at @apps88 or +91 905 957 4321 in telegram.
If you are facing any issues while copying the Code/Script or any issues with Posts, Please send a mail to OracleApp88@Yahoo.com or message me at @apps88 or +91 905 957 4321 in telegram.
Friday, August 5, 2011
Calculating Weekdays between two dates
Subscribe to:
Post Comments (Atom)
If you are facing any issues while copying the Code/Script or any issues with Posts, Please send a mail to OracleApp88@Yahoo.com or message me at @apps88 or +91 905 957 4321 in telegram.
No comments:
Post a Comment