Link to home
Start Free TrialLog in
Avatar of shelbyinfotech
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
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

I'm guessing you are trying to use this in a where clause and it is causing a syntax problem.

Can you post more of the query and what you are trying to do?  You might need dynamic SQL.
what about:

CASE WHEN TYPE_ASSMT = 'F' THEN TTL_APPRAISE ELSE FUL_APPRAISE END AS APPRAISAL

anyhow, what exactly is the error you get?
Avatar of shelbyinfotech

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
ASKER CERTIFIED SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial