Oracle Plsql Next_day Function

Oracle / PLSQL: NEXT_DAY Function

This Oracle tutorial explains how to use the Oracle/PLSQL NEXT_DAY function with syntax and examples.

Description

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

Syntax

The syntax for the NEXT_DAY function in Oracle/PLSQL is:

NEXT_DAY( date, weekday )

Parameters or Arguments

date

A date value used to find the next weekday.

weekday

The day of the week that you wish to return. It can be one of the following values:

Value Description
SUNDAY First Sunday greater than date
MONDAY First Monday greater than date
TUESDAY First Tuesday greater than date
WEDNESDAY First Wednesday greater than date
THURSDAY First Thursday greater than date
FRIDAY First Friday greater than date
SATURDAY First Saturday greater than date

Returns

The NEXT_DAY function returns a date value.

Applies To

The NEXT_DAY function can be used in the following versions of Oracle/PLSQL:

  • Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i

Example

Let's look at some Oracle NEXT_DAY function examples and explore how to use the NEXT_DAY function in Oracle/PLSQL.

For example:

NEXT_DAY('01-Aug-03', 'TUESDAY')
Output: '05-Aug-03'

NEXT_DAY('06-Aug-03', 'WEDNESDAY')
Output: '13-Aug-03'

NEXT_DAY('06-Aug-03', 'SUNDAY')
Output: '10-Aug-03'