MONTHS_BETWEEN(date1, date2):
Finds the number of months between date1 and date2. The result can be positive or negative. If date1 is later than date2, the result is positive; if date1 is earlier than date2, the result is negative.
The noninteger part of the result represents a portion of the month.
For Example:-
SELECT employee_id, hire_date,
MONTHS_BETWEEN (SYSDATE, hire_date) Experiance in Months
from employees
/
ADD_MONTHS(date, n): Adds n number of calendar months to date.
The value of n must be an integer and can be negative.
For example We want to display review date of an employee.six-month review date.
select ADD_MONTHS (hire_date, 6) REVIEW from employees;
0 Comment to "MONTHS_BETWEEN,ADD_MONTHS"
Post a Comment