Q:

Write a Oracle SQL statement to get the first and last day of the current year

0

Write a Oracle SQL statement to get the first and last day of the current year.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Oracle Code:

SELECT TRUNC (SYSDATE, 'YEAR') "First Day of the year" FROM DUAL;
SELECT ADD_MONTHS (TRUNC (SYSDATE, 'YEAR'), 12) - 1 "Last Day of the Year" FROM DUAL;

Output:

  	First Day of the year
1	1/1/2021 12:00:00 AM

  	Last Day of the Year
1	12/31/2021 12:00:00 AM

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now