Getting to know the ADD_MONTHS function
Mathematical arithmetical operations that are done on the DATE
value express the day granularity. Thus, adding a value of 1
to the DATE
value results in tomorrow being reflected while the original time values remain the same.
The ADD_MONTHS
function has two parameters – the date value (date_val
) and the number of months (number_months
) to be added or subtracted. The result is the input date with processed months. Such functionality can also be done explicitly by parsing the DATE
attribute. However, the transition between years and months must be handled explicitly.
The syntax of the ADD_MONTHS
function is stated in the following line:
ADD_MONTHS(<date_val>, <number_months>)
The following code snippet highlights its usage. The shift of the month, denoted by the second parameter of the ADD_MONTH
function, can be positive as well as negative, expressing adding or subtracting months. The first statement adds 7
months...