create or replace function F_GETAGE(dateofbirth date) return varchar2
is
begin
if((SYSDATE-dateofbirth)>=365) then
return trunc((SYSDATE-dateofbirth)/365);
else
if((SYSDATE-dateofbirth)<31) then
return trunc((SYSDATE-dateofbirth));
else
return trunc((SYSDATE-dateofbirth)/30);
end if;
end if;
end;

to_number((floor(MONTHS_BETWEEN(sysdate,a.dateofbirth)/12)))||'' age

05-23 02:45