Multiple choice technology databases

Assuming today is Monday, 10 July 2000, what is returned by this statement: SELECT to_char(NEXT_DAY(sysdate, 'MONDAY'), 'DD-MON-RR') FROM dual;

  1. 03-JUL-00

  2. 10-JUL-00

  3. 11-JUL-00

  4. 17-JUL-00

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

NEXT_DAY(sysdate, 'MONDAY') returns the next occurrence of Monday after the current date. Since today is Monday July 10, 2000, the next Monday is July 17, 2000. The to_char format 'DD-MON-RR' produces '17-JUL-00'. Options A and B show dates before or on the current day, while option C shows July 11 which is a Tuesday.

AI explanation

Oracle's NEXT_DAY(date, day_name) returns the date of the first weekday named 'day_name' that is later than the given date — strictly greater, never the date itself. Given sysdate = Monday, 10-JUL-2000, NEXT_DAY(sysdate,'MONDAY') skips the current Monday and returns the following Monday, 17-JUL-2000 (id 598584). The marked answer 11-JUL-00 is not only wrong by Oracle's semantics, it is a Tuesday, so it could never be the result of asking for the next MONDAY. 10-JUL (same day) and 03-JUL (prior Monday) are likewise impossible because the result must be strictly after the input date.