add_months(date,n)
返回指定日期date加上n月后的日期
select add_months(to_date('20190321','yyyyMMdd'),22) from dual;--返回2021/1/21
last_day(date,n)
返回指定日期date减去n个月后的日期
select last_day(to_date('20190321','yyyyMMdd')) from dual;--返回指定日期月份的最后一天 2019/3/31
select last_day(to_date('20190321','yyyyMMdd')) from dual;--返回2019/3/31
months_between(d1,d2)
返回2个日期的差值
select months_between(to_date('20190321','yyyyMMdd'),to_date('20190421','yyyyMMdd')) from dual;--返回-1
select months_between(to_date('20190321','yyyyMMdd'),to_date('20190301','yyyyMMdd')) from dual;--返回0.645161290322581
select months_between(to_date('20190321','yyyyMMdd'),to_date('20190321','yyyyMMdd')) from dual;--返回0