An example of Db2-SQL to find the next working day and skip the weekend. In this example Friday and Saturday both are weekends.
SELECTsysdate AS current_date,DAYNAME (sysdate) current_day,sysdate + 3 AS come_after_3_days,DAYNAME (sysdate+3) oh_after_3_is_friday,decode(DAYNAME (sysdate + 3),'Friday',(sysdate + 3) + 2,'Saturday',(sysdate + 3) + 1,(sysdate + 3)) so_the_nextworkday_is,dayname(decode(DAYNAME (sysdate + 3),'Friday',(sysdate + 3) + 2,'Saturday',(sysdate + 3) + 1,(sysdate + 3))) AS so_the_nextworkday_is_sundayFROMsysibm.sysdummy1
No comments:
Post a Comment