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!

Holiday Count between dates

Newuser1Jul 23 2021 — edited Jul 23 2021

Hi Team,
We have to find the count of working days between 2 dates (Job_Start_Date and Job_End_Date) it has to exclude weekends and public holidays using JOB (it’s a type 2 table have to use Curr_flag=’Y’ for latest data) and CALENDER tables.
JOB table contains Job_Start_Date and Job_End_Date and CALENDER table contains holiday and weekend information Holiday_flag (‘Y’,’N’) and Weekend_flag (‘Y’,’N’).
So using JOB table first we are calculating the Day_Diff_Count between 2 dates and Weekend_Count between 2 dates using below query.
Query:
SELECT A.JOB_ID, A.JOB_START_DATE, A.JOB_END_DATE,
ROUND(JOB_END_DATE)-(JOB_START_DATE)) as Day_Diff_Count,
least(7-to_char(FORECASTED_START_DATE,'DAY','NLS_DATE_LANGUAGE=''numeric date language''')+1,2)
+greatest (to_char (ACTUAL_COMPLETION_DATE,'DAY','NLS_DATE_LANGUAGE=''numeric date language''')-5,0)
+ ((trunc(ACTUAL_COMPLETION_DATE,'IW')-trunc(FORECASTED_START_DATE,'IW'))/7-1)*2 as Weekend_Count
from JOB A
where
A.CURR_FLG=’Y’ ------ this query is working for weekend count
How to find Holiday_Count from CALENDER and JOB tables, also if holiday is weekend then it should not count (bcoz in the above query we already find the weekend count) , here we have to use TIME_KEY to join with JOB table using between dates like below query.
SELECT A.JOB_ID, A.JOB_START_DATE, A.JOB_END_DATE,
ROUND(JOB_END_DATE)-(JOB_START_DATE)) as Day_DIFF_Count,
least(7-to_char(FORECASTED_START_DATE,'DAY','NLS_DATE_LANGUAGE=''numeric date language''')+1,2)
+greatest (to_char (ACTUAL_COMPLETION_DATE,'DAY','NLS_DATE_LANGUAGE=''numeric date language''')-5,0)
+ ((trunc(ACTUAL_COMPLETION_DATE,'IW')-trunc(FORECASTED_START_DATE,'IW'))/7-1)*2 as Weekend_Count,
------------- as Holiday_Count
from JOB A , CALENDER B
where B.TIME_KEY between A.JOB_START_DATE and A.JOB_END_DATE
and A.CURR_FLG=’Y’
Finally we will add weekend_count and Holiday_Count and minus with Day_Diff_Count to get exact working days.
Can someone suggest on this, hope you got my issue/task.
Thanks in advance,

Comments

Alex Keh-Oracle
Answer

The current async implementation, task-based, is the third .NET iteration for asynchronous programming models. Before task-based async, there was event-based pattern and the async programming model. .NET async programming patterns have been around since near the beginning of .NET FW itself. And the reason why these async models have changed over time is because there was never a popular async model until the most recent iteration.

And therein lies the reason why ODP.NET has taken a wait and see approach. Async .NET programming is not new, but historically it had never gone mainstream.

With that said, Oracle is working on supporting task-based async. We'll have more details during Oracle OpenWorld in September.

Marked as Answer by OnurGumus · Sep 27 2020
OnurGumus

Dear Alex,

I disagree with your below comment:

" Async .NET programming is not new, but historically it had never gone mainstream."

As of now except Oracle, all database vendors that support .NET, also support proper asynchronous API.

Alex Keh-Oracle

Hi Onur,

What I meant by that statement was that the event-based pattern and the async programming model were not popular among .NET developers and eventually abandoned by Microsoft. Vendors who devoted much effort to supporting those earlier two models had to invest yet again in async with the task-based async pattern. Oracle has approached supporting a new async pattern relatively cautiously when noting the history.

user12186381

Hi Alex,

Any plans to make the async make GA?

I see that we have a pre-release available, but clearly states that should be used in Production Environments.

I'm just waiting for the final release to start using it in our projects.

Thanks,

Alex Keh-Oracle

ODP.NET Async is part of 23c client. When 23c DB goes GA, the client will also be GA.

The plan is to have DB 23c GA in the first half of 2024.

1 - 5

Post Details

Added on Jul 23 2021
2 comments
800 views