View previous topic :: View next topic
|
Author |
Message |
EnjoyMF
New User
Joined: 27 May 2005 Posts: 88
|
|
|
|
hi friends
i have a requirement where i need to find if the age is greater than 65years, if it is then i need to add one month to it...
how can this done though DB2 query..plz provide me the query if possible
Regards
prasad |
|
Back to top |
|
|
kvivek
New User
Joined: 09 May 2005 Posts: 51 Location: Singapore
|
|
|
|
Quote: |
if the age is greater than 65years |
Code: |
SELECT YEAR(CURRENT_DATE - DATE(:WS-DOB)) INTO :WS-NO-OF-YEARS FROM SYSIBM.SYSDUMMY1 |
Quote: |
if it is then i need to add one month to it... |
Code: |
SELECT DATE(:WS-DOB) + 1 MONTH INTO :WS-DOB FROM SYSIBM.SYSDUMMY1 |
Regards,
Vivek |
|
Back to top |
|
|
khamarutheen
Active Member
Joined: 23 Aug 2005 Posts: 677 Location: NJ
|
|
|
|
hi frnd,
hope this query will give u that age det as my frnd given earlier
SELECT YEAR(CURRENT_DATE - DATE(:WS-DOB)) INTO :WS-NO-OF-YEARS FROM SYSIBM.SYSDUMMY1
then check IF WS-NO-OF-YEARS >=65 then
EXEC SQL
UPDATE SET that variable name=varname+1
END-EXEC |
|
Back to top |
|
|
|