QuestionQ33

VerifiedUsing Single-Row Functions to Customize Output

You run the following query:

SELECT TO_CHAR(NEXT_DAY(LAST_DAY(SYSDATE), 'MON'), 'dd "Monday for" fmMonth rrrr')  
FROM DUAL;  

What result does it produce?

Explanation

LAST_DAY(SYSDATE) returns the last day of the current month, and NEXT_DAY returns the first specified weekday strictly after that date. Therefore, requesting MON returns the first Monday of the next month; TO_CHAR only formats that date for display.

Community Discussion

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