select years,months,abs(
trunc(
newer_date-
add_months( older_date,years*12+months )
)
) days from (select
trunc(months_between( to_date(\'20180625\', \'yyyymmdd\'), to_date(\'19960626\', \'yyyymmdd\') )/12) YEARS,
mod(trunc(months_between(to_date(\'20180625\', \'yyyymmdd\'), to_date(\'19960626\', \'yyyymmdd\') )),12 ) MONTHS,
to_date(\'20180625\', \'yyyymmdd\') newer_date,
to_date(\'19960626\', \'yyyymmdd\') older_date
from dual) shisui
相关文章: