How to get the next date for a weekday using Oracle

If you ever need to find the next weekday from a given date in Oracle it turns out they have a built in function for doing just that. If you want the next Sunday from yesterday you would do:

SELECT NEXT_DAY(SYSDATE - 1, 'SUN') FROM dual;

Valid entries for the day are: SUN, MON, TUE, WED, THU, FRI, and SAT

Tags: ,

2 thoughts on “How to get the next date for a weekday using Oracle

  1. ACrush

    Which version is it? In Version 9 this returns exactly the date next SUNDAY will be. Not next weekday. By the way, the valid entries are sometimes not in english. I have an installation where only Russian abbreviations work.

  2. carson Post author

    I did my test in 10g. To be clear, this returns the next day of the week with the given name. If you want the day name of tomorrow you should try: SELECT to_char(sysdate + 1, 'DY') FROM dual;

Leave a Reply

Your email address will not be published. Required fields are marked *