I've read all the threads and am still having problems with a derived field to calculate a date. I thought that the statement below would do the trick, but am getting the infamous Missing right parenthesis message. I am wanting to find everyone who has a cmpny_seniority_dt = (25, 30, 35, 40, 45 or 50). This would be based on a variable date. I plopped in ReportsEffectiveDate to use.
Is this the appropriate statement?
CASE
WHEN TRUNC(((<<"ReportsEffectiveDate", "TO_DATE("yyyy"-"mm"-"dd"', 'YYYY-MM-DD')">> - "EMPLOY"."CMPNY_SENIORITY_DT" / 365.25 )) = 25 THEN 25
WHEN TRUNC(((<<"ReportsEffectiveDate", "TO_DATE("yyyy"-"mm"-"dd"', 'YYYY-MM-DD')">> - "EMPLOY"."CMPNY_SENIORITY_DT" / 365.25 )) = 30 THEN 30
WHEN TRUNC(((<<"ReportsEffectiveDate", "TO_DATE("yyyy"-"mm"-"dd"', 'YYYY-MM-DD')">> - "EMPLOY"."CMPNY_SENIORITY_DT" / 365.25 )) = 35 THEN 35
WHEN TRUNC(((<<"ReportsEffectiveDate", "TO_DATE("yyyy"-"mm"-"dd"', 'YYYY-MM-DD')">> - "EMPLOY"."CMPNY_SENIORITY_DT" / 365.25 )) = 40 THEN 40
WHEN TRUNC(((<<"ReportsEffectiveDate", "TO_DATE("yyyy"-"mm"-"dd"', 'YYYY-MM-DD')">> - "EMPLOY"."CMPNY_SENIORITY_DT" / 365.25 )) = 45 THEN 45
WHEN TRUNC(((<<"ReportsEffectiveDate", "TO_DATE("yyyy"-"mm"-"dd"', 'YYYY-MM-DD')">> - "EMPLOY"."CMPNY_SENIORITY_DT" / 365.25 )) = 50 THEN 50
ELSE X
END)
I've been working on this for several hours.
Thanks
Is this the appropriate statement?
CASE
WHEN TRUNC(((<<"ReportsEffectiveDate", "TO_DATE("yyyy"-"mm"-"dd"', 'YYYY-MM-DD')">> - "EMPLOY"."CMPNY_SENIORITY_DT" / 365.25 )) = 25 THEN 25
WHEN TRUNC(((<<"ReportsEffectiveDate", "TO_DATE("yyyy"-"mm"-"dd"', 'YYYY-MM-DD')">> - "EMPLOY"."CMPNY_SENIORITY_DT" / 365.25 )) = 30 THEN 30
WHEN TRUNC(((<<"ReportsEffectiveDate", "TO_DATE("yyyy"-"mm"-"dd"', 'YYYY-MM-DD')">> - "EMPLOY"."CMPNY_SENIORITY_DT" / 365.25 )) = 35 THEN 35
WHEN TRUNC(((<<"ReportsEffectiveDate", "TO_DATE("yyyy"-"mm"-"dd"', 'YYYY-MM-DD')">> - "EMPLOY"."CMPNY_SENIORITY_DT" / 365.25 )) = 40 THEN 40
WHEN TRUNC(((<<"ReportsEffectiveDate", "TO_DATE("yyyy"-"mm"-"dd"', 'YYYY-MM-DD')">> - "EMPLOY"."CMPNY_SENIORITY_DT" / 365.25 )) = 45 THEN 45
WHEN TRUNC(((<<"ReportsEffectiveDate", "TO_DATE("yyyy"-"mm"-"dd"', 'YYYY-MM-DD')">> - "EMPLOY"."CMPNY_SENIORITY_DT" / 365.25 )) = 50 THEN 50
ELSE X
END)
I've been working on this for several hours.
Thanks