Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: strange function result
hi,
i think your problem is that you don't have the (right) century stored in
your bdate column. If you look at the 4th result column: bdate 20-jun-31,
age -34 and interpret it as 20-jun-2031 then age -34 makes sense!
-- At Home: gem_at_wirehub.nl At Work: gert.rijs_at_corp.ah.nl Royce Medlock <medlocrf_at_dunx1.ocs.drexel.edu> wrote in article <5djiae$i8k_at_noc2.drexel.edu>...Received on Mon Feb 10 1997 - 00:00:00 CST
> I have created the following function:
>
> create or replace function AGE(a_bdate employee.bdate%type)
> return INT IS
> age INT;
> Begin
> select trunc(MONTHS_BETWEEN(SYSDATE, BDATE)/12) into age
> from employee
> where bdate = a_bdate;
> RETURN age;
> END AGE;
>
> here is some sample data I get when I use it:
>
> BDATE AGE
> --------- ----------
> 09-JAN-55 42
> 15-SEP-52 44
> 19-JUL-58 38
> 20-JUN-31 -34
<snip>