Question 1
You execute this query:
SELECT TO CHAR (NEXT_DAY(LAST_DAY(SYSDATE),’MON’ ),’ dd“Monday for” fmMonth rrr’) FROM DUAL;
What is the result?
- AOption A:
It executes successfully but does not return any result.
- BOption B:
It returns the date for the first Monday of the next month.
- COption C:
It generates an error.
- DOption D:
It returns the date for the last Monday of the current month.
Show answer and explanation
Correct answer: B
The query uses TO_CHAR and NEXT_DAY functions to format and determine dates:
B. It returns the date for the first Monday of the next month: The function NEXT_DAY(LAST_DAY(SYSDATE), ' MON ' ) finds the next Monday after the last day of the current month, effectively giving the first Monday of the next month. The TO_CHAR formatting is used to return this in a readable format.