Oracle get the end of the year, the end of the month, the end of the quarter, the end of the oracle month
1 -- early year, end 2 select trunc (sysdate, 'yyyy') from dual; 3 select add_months (trunc (sysdate, 'yyyy'), 12)-1 from dual; 4 5 -- early month, end 6 select trunc (sysdate, 'month') from dual; 7 select add_months (trunc (sysdate, 'month'), 1)-1 from dual; 8 9 -- select trunc (sysdate, 'q') from dual; 11 select add_months (trunc (sysdate, 'q'), 3)-1 from dual;
If the end of the previous year is required, only one day is required for the beginning of the year. For the beginning of the next year, only one day is required for the end of the year.
Corresponding to the day before the end of the month, the day after the end of the month, the day before the beginning of the quarter, and the day after the end of the quarter, you only need to add one day or minus one day.