get next work day in a week
Hi
I am trying to the next working day in a week using decode function but unfortunately I am not getting the desired result. Please help me where I am wrong.
Our payment dates are set to two working days from the sysdate. For Monday payment dates, we calculate 2 working days which is Wednesday and so forth. But if it is Thursday or Friday, we would like to get the next working day (Monday's) date to avoid weekends.
select decode(to_char(sysdate,'DAY'),
'THURSDAY', sysdate+4, 'FRIDAY', sysdate+3, sysdate+2) from dual;
Unfortunately, the query returns the default result (sysdate+2) for all working days which defeats the purpose.
Our payment dates are set to two working days from the sysdate. For Monday payment dates, we calculate 2 working days which is Wednesday and so forth. But if it is Thursday or Friday, we would like to get the next working day (Monday's) date to avoid weekends.
select decode(to_char(sysdate,'DAY'),
'THURSDAY', sysdate+4, 'FRIDAY', sysdate+3, sysdate+2) from dual;
Unfortunately, the query returns the default result (sysdate+2) for all working days which defeats the purpose.
0