PL/SQL (MOSC)

MOSC Banner

get next work day in a week

edited Oct 12, 2009 2:49AM in PL/SQL (MOSC) 19 commentsAnswered
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.

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center