Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Calculating age of a person in PL/SQL

Re: Calculating age of a person in PL/SQL

From: Randi Wølner <randiwolner_at_hotmail.com>
Date: Wed, 5 Sep 2001 12:38:13 +0200
Message-ID: <9n4van$n9q$1@oslo-nntp.eunet.no>


Oh - I was not aware of having to use "trunc"..

Thank you very very much!!

-Randi

cf <news_at_sitinfo.com> wrote in message
news:3b95ff01$0$14586$4d4eb98e_at_read.news.fr.uu.net...
> No pb for me.
>
> select trunc(months_between('05-SEP-2001','04-SEP-1971')/12) age from dual
> SQL > 30
> select trunc(months_between('05-SEP-2001','06-SEP-1971')/12) age from dual
> SQL > 29
>
>
> "Randi Wølner" <randiwolner_at_hotmail.com> a écrit dans le message news:
> 9n4uc8$jnr$1_at_oslo-nntp.eunet.no...
> > What is the most efficient way of calculating a person's age at a
certain
> > date?
> > I have to create a PL/SQL function for doing it, and first I tried using
> > MONTHS_BETWEEN and then dividing by 12,
> > but the result will be wrong for the month of the persons's birthday..
> >
> > I guess someone has done something like this before - and hope you'll
> > share..
> >
> > Thanks,
> > Randi Wølner
> >
> >
>
>
Received on Wed Sep 05 2001 - 05:38:13 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US