Getting to know DATE arithmetic
Adding or subtracting a numerical value from the DATE
value expresses the number of days (or a part of a day, for example, 0.5 expressing 12 hours):
select TO_DATE ('15.02.2022', 'DD.MM.YYYY') + 1 from dual; --> 16.02.2022 00:00:00
Just to remind you, the TO_DATE
conversion function in the preceding example deals only with the day, month, and year elements. In that case, the conversion causes undefined components (hours, minutes, and seconds) to be replaced with zero values.
Addition or subtraction automatically reflects the value consistency. Thus, if we’re looking at the last day of the month, adding 1 day produces the first day of the consecutive month, as expressed in the following code:
select TO_DATE ('28.02.2022', 'DD.MM.YYYY') + 1 from dual; --> 1.3.2022 00:00:00 select TO_DATE ('31.12.2022', 'DD.MM.YYYY') + 1 from dual; --> 1.1.2023 00:00:00
The decimal...