My query is somewhat like this:
select 1 from dual where :p1_task_date in (sysdate,sysdate+1,sysdate-1) and :p1_task_id is not null
This works fine, but I wanted to get next/previous working days (next/previous week days) instead of sysdate+1 and sysdate-1. I tried something like:
select next_day(sysdate, to_char(sysdate+1,'DAY')) from dual`
but cannot proceed with this :(
Please Help!!!!
@Tawman's answer will work, but I prefer this method for readability:
select sysdate as current_date,
case when to_char(sysdate,'D') in (1,6,7)
then next_day(sysdate,'Monday')
else sysdate+1 end as next_weekday,
case when to_char(sysdate,'D') in (1,2,7)
then next_day(sysdate-7,'Friday')
else sysdate-1 end as prev_weekday
from dual
As everyone else has stated, this will only work to exclude weekends, not holidays.