Skip to Main Content

Analytics Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Calculate Age With Only DOB? OBIEE

mrmmickle1Dec 22 2015 — edited Dec 29 2015

I would like to calculate Age base on DOB.  I'm getting an error on syntax.  Not familiar with the appropriate PL/SQL Syntax for nesting IF/THEN Statements.  Any help would be fantastic:

@{Current_Date} = Current Date

"Employee Personal Attributes"."Employee Birth Date" = DOB

WHEN IFNULL("Employee Personal Attributes"."Employee Birth Date", 0)<> 0 THEN

   

    WHEN MONTH("Employee Personal Attributes"."Employee Birth Date") <  (Month(@{CURRENT_DATE})) Or (Month("Employee Personal Attributes"."Employee Birth Date") = Month(@{CURRENT_DATE}) And Day("Employee Personal Attributes"."Employee Birth Date") <= Day(@{CURRENT_DATE})) Then

   

    TIMESTAMPDIFF(SQL_TSI_YEAR,"Employee Personal Attributes"."Employee Birth Date", @{CURRENT_DATE})

    Else

    TIMESTAMPDIFF(SQL_TSI_YEAR,"Employee Personal Attributes"."Employee Birth Date", @{CURRENT_DATE})-1

   

    End

   

ELSE

0

End

Any Help would be very much appreciated!

This post has been answered by Gianni Ceresa on Dec 23 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details