calculate days between two given dates in sql query oracle code example
Example 1: oracle difference between two dates in years
select floor(months_between(date '2012-10-10', date '2011-10-10') /12) from dual;
select floor(months_between(date '2012-10-9' , date '2011-10-10') /12) from dual;
Example 2: oracle difference between two dates in days
v_numvar := dt1-dt2;