NEXT_DAY

NEXT_DAY function returns the date of the first instance of the particular day of the week after the specified date.

Format: NEXT_DAY (input_date, day_of_the_week);

Note: For the examples below – the SYSDATE is: 10/30/2018 2:08:06 PM

Example1:

select NEXT_DAY (SYSDATE, 'WEDNESDAY') FROM DUAL;

Result: 10/31/2018 2:08:06 PM

Example2: (takes lower case of the day)

select NEXT_DAY (SYSDATE, 'monday') FROM DUAL;

Result: 11/5/2018 2:08:06 PM

Example3: (the function allows a little typo in the name of the day).

select NEXT_DAY (SYSDATE, 'monnnnnnday') FROM DUAL;

Result: 11/5/2018 2:08:06 PM

Example4: (if the day is not a day of the week at all – then it throws an error).

SELECT NEXT_DAY (SYSDATE, 'testday') FROM DUAL;

Result: Error.