QuestionQ221

VerifiedUsing Single-Row Functions to Customize Output

The EMPLOYEES table has columns EMP_ID with data type NUMBER and HIRE_DATE with data type DATE.

You want to display the date of the first Monday after six months from the hiring date have elapsed.

The NLS_TERRITORY session parameter is set to AMERICA; therefore, Sunday is the first day of the week.

Which query can be used?

Explanation

ADD_MONTHS returns a date offset by the specified number of months, and NEXT_DAY(date, char) returns the first named weekday later than its date argument. NEXT_DAY(ADD_MONTHS(hire_date, 6), 'MONDAY') therefore returns the first Monday after the six-month anniversary of each hire date.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!