Home » SQL & PL/SQL » SQL & PL/SQL » Find next working day within the same period (PL SQL)
Find next working day within the same period [message #675476] Tue, 02 April 2019 02:22 Go to next message
EPerry123
Messages: 2
Registered: April 2019
Junior Member
Hi, I am reporting on daily orders taken, some orders happen on none working days i.e. weekends or bank holidays so I need to report those non working day orders against the previous working day OR if the period changes between the order day and the previous working day then I need to report those orders against the next working day. For example orders on Saturday 30/03/2019 need to show against Friday 29/03/2019 but if the Saturday had been 01/04/2019 then I would need to show the orders against Monday 03/04/2019. I figured out the first part but then discovered the second part, the period change as an issue. Does anyone have any ideas? Thanks
Re: Find next working day within the same period [message #675482 is a reply to message #675476] Tue, 02 April 2019 05:07 Go to previous messageGo to next message
John Watson
Messages: 8922
Registered: January 2010
Location: Global Village
Senior Member
Welcome to the forum. Please read the OraFAQ Forum Guide and How to use code tags and make your code easier to read

How are you identifying non-working days?
How are you identifying periods?
Re: Find next working day within the same period [message #675483 is a reply to message #675482] Tue, 02 April 2019 05:15 Go to previous messageGo to next message
EPerry123
Messages: 2
Registered: April 2019
Junior Member
Hi John, thanks. I'm linking my orders table (field update_date) to a calendar table (field cal_date) which returns whether the date is a working day or not, period is just the month number from the update_date. Actually just finding the last working day is straightforward it's just the issue of when the period changes between the update_date and the last working date how do I then tell it to go forward to the next working date instead?
Re: Find next working day within the same period [message #675485 is a reply to message #675483] Tue, 02 April 2019 05:24 Go to previous message
John Watson
Messages: 8922
Registered: January 2010
Location: Global Village
Senior Member
Can you use a CASE expression in your column projection list to generate the column value? The expression would have to check whether the date is within a day (or two) of the end of the month.

Previous Topic: How to send sms to no of mobile numbers using url in plsql procedure
Next Topic: Compare and contrast TRUNCATE and DELETE for a table
Goto Forum:
  


Current Time: Thu Mar 28 04:24:55 CDT 2024