Friday, January 11, 2013

Next_Day Function


In Oracle/PLSQL, the next_day function returns the first weekday that is greater than a date.

Syntax

The syntax for the 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)

Applies To

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

For Example

next_day('01-Aug-03', 'TUESDAY')would return '05-Aug-03'
next_day('06-Aug-03', 'WEDNESDAY')would return '13-Aug-03'
next_day('06-Aug-03', 'SUNDAY')would return '10-Aug-03'