0
我必須使用oracle日程安排查找最近5個工作日。Oracle Schdule上的最後5個工作日(排除週六和週日)
select sysdate as current_date,
case when to_char(sysdate,'D') in (1,2,7)
then next_day(sysdate-7,'Friday')
else sysdate-1 end as prev_weekday1,
case when to_char(sysdate,'D') in (1,2,7)
then next_day(sysdate-7,'Friday')
else sysdate-2 end as prev_weekday2,
case when to_char(sysdate,'D') in (1,2,7)
then next_day(sysdate-7,'Friday')
else sysdate-3 end as prev_weekday3,
case when to_char(sysdate,'D') in (1,2,7)
then next_day(sysdate-7,'Friday')
else sysdate-4 end as prev_weekday4,
case when to_char(sysdate,'D') in (1,2,7)
then next_day(sysdate-7,'Friday')
else sysdate-5 end as prev_weekday5
from dual
請幫助我是這種方式是正確的或任何其他優化的方式是有。
調度不能在運行最近幾個工作日,因爲他們已經發生。調度程序如何適應您的問題? – Ben