Oracle Date/Time Function - Oracle/PLSQL NEXT_DAY Function






This Oracle tutorial explains how to use the Oracle/PLSQL NEXT_DAY function.

The Oracle/PLSQL NEXT_DAY function returns the first weekday that is greater than a date.

NEXT_DAY(x, day) returns the date of the next day following x. day is specified as a literal string (SATURDAY, for example).

Syntax

The syntax for the Oracle/PLSQL NEXT_DAY function is:

NEXT_DAY( date, weekday )

date is used to find the next weekday.

weekday is a day of the week (ie: SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY)

Example

The following example displays the date of the next Saturday after January 1, 2008:


SQL> SELECT NEXT_DAY('01-JAN-2008', 'SATURDAY') FROM dual;

NEXT_DAY(
---------
05-JAN-08

SQL>