create or replace FuncTion ft_calagemth( adtm_from date , adtm_to date ) return varchar
is
ldc_age	number(15,10);
ls_year varchar(5);
ls_mth	varchar(5);
ls_age 	varchar(10);
begin
	if adtm_from is null then
		return '0.00';
	end if;
	if adtm_to is null then
		return '0.00';
	end if;
	select months_between( adtm_to , adtm_from ) 
	into ldc_age
	from dual;
	ls_year	:= to_char(trunc( ldc_age - mod( ldc_age , 12 ) , 0 )/12);
	ls_mth	:= to_char(trunc( mod( ldc_age , 12 ), 0 ));
	ls_age	:= ls_year || '.' || lpad(ls_mth,2 ,'0' );
	return trim(ls_age);
end ;
/
