cancel
Showing results for 
Search instead for 
Did you mean: 

Calculate Age

Former Member
0 Kudos

I am brand new to this product and I have not yet had any training.

I am trying to calulate a persons age by using this syntax

trunc(to_decimal(to_char(sysdate(),'yyyymmdd'), '.', ',', 0)

-to_decimal(to_char( Query1.DOB,'yyyymmdd'), '.', ',', 0),0)

/1000

It seems to work until I get to /1000. Instead of dividing by 1000, it multiplies by 1000.

Is the symbol for divide different ?

Cheers

Gus

Edited by: guscrighton on Feb 15, 2012 1:43 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

what is your input data type? What is the format of DOB in source?

Former Member
0 Kudos

DOB source is a date column in a table

Gus

Former Member
0 Kudos

Why don't you try this...


(date_diff( sysdate(),Query1.DOB,'D'))/368

Maintain the target column as integer (int).

Regards,

Suneer

Former Member
0 Kudos

Thanks, it worked

Gus

Answers (0)