Exploring the NEXT_DAY and NEXT_DATE functions
It often happens that you need to find the next free day in your calendar, the date of the next Wednesday, or the date of the second Sunday of the month when system updates are to be performed. In this section, we will take a closer look at two functions. The first of them is directly available within the database system. It refers to the NEXT_DAY
function. However, as we will show, its evaluation and processing depend on several factors, specifically NLS parameters. Therefore, in the second part, we will propose an own
function implementation that is resistant to changes in terms of the format and local parameters.
Exploring the principles of the NEXT_DAY function
The output of the NEXT_DAY function is the first weekday greater than the defined input date (date_val
):
NEXT_DAY(<date_val>, <weekday>)
The following table shows the mapping principles.
Weekday ... |