hi all, consider the following data:
WITH data AS (
SELECT To_Date('08/21/2015','mm/dd/yyyy') + 1 weekday FROM dual
UNION ALL
SELECT To_Date('08/24/2015','mm/dd/yyyy') + 1 weekday FROM dual
UNION ALL
SELECT To_Date('08/28/2015','mm/dd/yyyy') + 1 weekday FROM dual
UNION ALL
SELECT To_Date('09/2/2015','mm/dd/yyyy') + 1 weekday FROM dual
)
i hardcoded the dates but in the original query it will be dynamically. what i want to do is to find out if date + 1 falls on a weekend. if it does, then i want to increase the date to the next available weekday. if it is not a weekend, then leave date + 1 intact. my output from the data above should be:
weekday
=========
08/24/2015 -- aug 21+ 1 falls on a weekend, so increase the date to next available weekday (8/24)
08/25/2015 --aug24 + 1 falls in a weekday so leave intact
08/31/2015 -- aug28 + 1 falls on a weekend, so increase the date to next available weekday (8/31)
09/03/2015 --sep02 + 1 falls in a weekday so leave intact
can someone help me write a query that perform the above output? thanks