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!

Weekend days skip in SQL

GQJun 21 2010 — edited Jun 29 2010
Dear All,

KI want to write one query where I want to see the request of one transaction. I want that report should display the working days count only and ignore weekend days. I want to run the query as following in which it says show the days difference from approval tp arrival date if greater than one week. I have put 7 but I want it should skip weekend days (2 days) for example if the transaction has happened on FRIDAY and Completed on TUESDAY it should tell it took 3 working days while ignoring Saturday and Sunday and tell 3 days only i.e. FRI, MON and TUE. I have written following query how to modify that to meet the above criteria? I would highly appreciate your response on this.

SELECT NAME, APPROVAL_DATE, PRINT_DATE, PRINT_DATE-APPROVAL_DATE, POST_DATE, POST_DATE-PRINT_DATE),ARRIVAL_DATE
FROM REPORT_TABLE
WHERE ARRIVED_DATE BETWEEN TO_DATE ('01062010', 'DDMMYYYY') AND TO_DATE ('20062010', 'DDMMYYYY') AND
ARRIVAL_DATE - APPROVAL_DATE > 7;

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 27 2010
Added on Jun 21 2010
8 comments
4,368 views