shelbyinfotech
asked on
Oracle Case When with fields in table
I cannot get this to work:
CASE TYPE_ASSMT WHEN 'F' THEN TTL_APPRAISE ELSE FUL_APPRAISE END AS APPRAISAL
Where TTL_APPRAISE and FUL_APPRAISE are columns in the table I am selecting from, I can get it to work with static values
It also fails using DECODE, I am attempting to select the value one of two fields based on the contents of another field
CASE TYPE_ASSMT WHEN 'F' THEN TTL_APPRAISE ELSE FUL_APPRAISE END AS APPRAISAL
Where TTL_APPRAISE and FUL_APPRAISE are columns in the table I am selecting from, I can get it to work with static values
It also fails using DECODE, I am attempting to select the value one of two fields based on the contents of another field
what about:
CASE WHEN TYPE_ASSMT = 'F' THEN TTL_APPRAISE ELSE FUL_APPRAISE END AS APPRAISAL
anyhow, what exactly is the error you get?
CASE WHEN TYPE_ASSMT = 'F' THEN TTL_APPRAISE ELSE FUL_APPRAISE END AS APPRAISAL
anyhow, what exactly is the error you get?
ASKER
Error from designer (Visual Studio 2010 )
Error in SELECT clause: expression near 'TYPE_ASSMT'.
Unable to parse query text.
Error from Database:
ORA-00918: column ambiguously defined
Error in SELECT clause: expression near 'TYPE_ASSMT'.
Unable to parse query text.
Error from Database:
ORA-00918: column ambiguously defined
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Can you post more of the query and what you are trying to do? You might need dynamic SQL.