1 2 3 4 5 6 7 8 9 10 11 12 13
| select
A,
(A - B) YEAR to MONTH itv,
trunc(months_between(A, B)/12) age_mb,
extract(year from (A - B) YEAR to MONTH) as age_int,
trunc(to_char(A,'YYYY,MMDD') - to_char(B,'YYYY,MMDD')) age_ls -- ',' est le symbole décimal sur ma base de test
from
(
select to_date('01/03/2010', 'dd/mm/yyyy') A, to_date('29/02/1992', 'dd/mm/yyyy') B from dual union all
select to_date('28/02/2010', 'dd/mm/yyyy') A, to_date('29/02/1992', 'dd/mm/yyyy') B from dual union all
select to_date('14/02/2010', 'dd/mm/yyyy') A, to_date('29/02/1992', 'dd/mm/yyyy') B from dual union all
select to_date('13/02/2010', 'dd/mm/yyyy') A, to_date('29/02/1992', 'dd/mm/yyyy') B from dual
) |
Partager