Oracle Tutorial

  • Home
  • Start Here
  • Basics
  • Advanced
    • Oracle View
    • Oracle Index
    • Oracle Synonym
    • Oracle Sequence
    • Oracle Administration
  • PL/SQL
  • Functions
    • Aggregate Functions
    • Analytic Functions
    • Comparison Functions
    • Date Functions
    • String Functions
  • API
    • Python Oracle
Home / Oracle Date Functions / Oracle NEXT_DAY

Oracle NEXT_DAY

The Oracle NEXT_DAY() function returns the date of the first weekday specified by day name that is later than a date.

Syntax

The following shows the syntax of the syntax of the NEXT_DAY() function:

NEXT_DAY(date,weekday)

Arguments

The NEXT_DAY() function accepts two arguments:

1) date

is a DATE value or an expression that evaluates to a DATE value which is used to find the next weekday.

2) weekday

is the day of week that you want to return.

The weekday can be full name e.g., Tuesday or abbreviation e.g., Tue. In addition, the language of the weekday must be in the language of your session.

In English, the weekday accepts the following values:

WeekdayAbbr.Return
SUNDAYSUNThe first Sunday later than a date
MONDAYMONThe first Monday later than a date
TUESDAYTUEThe first Tuesday later than a date
WEDNESDAYWEDThe first Wednesday later than a date
THURSDAYTHURThe first Thursday later than a date
FRIDAYFRIThe first Friday later than a date
SATURDAYSATThe first Saturday later than a date

Return value

The Oracle NEXT_DAY() function always returns a DATE value that represents the next weekday after the date.

The result date has the same hours, minutes, and second as the input date.

Examples

A) Get the next weekday later than a date

This example returns the date of the next Sunday after January 1, 2000:

Oracle NEXT_DAY function example
SELECT NEXT_DAY( DATE '2000-01-01', 'SUNDAY' ) FROM dual;

It returns the following output:

02-JAN-00

B) Get the next working day for employees 

See the following employees table in the sample database:

employees table

The following statement gets next working days days which are later than the hire dates for the employees:

SELECT first_name, last_name, hire_date, NEXT_DAY( hire_date, 'Monday' ) NEXT_MONDAY FROM employees ORDER BY hire_date DESC;

The following illustrates the output:

Oracle NEXT_DAY - Next Monday Example

In this example, the next working day of an employee is the next Monday after the hire date.

In this tutorial, you have learned how to use the Oracle NEXT_DAY() function to get the date of the next weekday which is later than a specified date.

  • Was this tutorial helpful?
  • YesNo
Previous Oracle MONTHS_BETWEEN
Next Oracle NEW_TIME

Oracle Functions

  • Aggregate Functions
  • Analytic Functions
  • Comparison Functions
  • Date Functions
  • String Functions

Oracle Date Functions

  • ADD_MONTHS
  • CURRENT_DATE
  • CURRENT_TIMESTAMP
  • DBTIMEZONE
  • EXTRACT
  • FROM_TZ
  • LAST_DAY
  • LOCALTIMESTAMP
  • MONTHS_BETWEEN
  • NEXT_DAY
  • NEW_TIME
  • ROUND
  • SESSIONTIMEZONE
  • SYSDATE
  • SYSTIMESTAMP
  • TO_CHAR
  • TO_DATE
  • TRUNC
  • TZ_OFFSET

About Oracle Tutorial

OracleTututorial.com website provides Developers and Database Administrators with the updated Oracle tutorials, scripts, and tips.

Search

Recent Tutorials

  • Oracle Implicit Statement Results
  • Calling PL/SQL Stored Functions in Python
  • Calling PL/SQL Procedures in Python
  • Managing Transaction in Python
  • Deleting Data From Oracle Database in Python

Site Links

  • Oracle Books
  • About
  • Contact
  • Privacy Policy
  • Terms of Use

Copyright © 2021 Oracle Tutorial. All Rights Reserved.