NESTED CASE statement in a SQL
768510Apr 27 2010 — edited May 4 2010 Hi,
I have written a NESTED CASE statement in a SQL but when try running it, I'm getting the error as "missing keyword"
Can someone help me in correcting this?
SELECT ITEM
,DETAIL_LEVEL_DESC AS DESCRIPTION
,COMP_DETAIL_ID AS PROMO_ID
,CASE WHEN CHANGE_TYPE = 'N'
THEN CASE WHEN INSTR(UPPER(DETAIL_LEVEL_DESC), 'S/P')!=0 THEN 'SPP'
WHEN INSTR(UPPER(DETAIL_LEVEL_DESC), 'NIO')!=0 THEN 'NIO'
ELSE 'NEW' END,
ELSE CASE WHEN INSTR(UPPER(DETAIL_LEVEL_DESC), 'SOE')!=0 THEN 'SOE'
ELSE 'SOM' END, SUBTYPE_CODE
FROM PROMO_COMP
ORDER BY ITEM;
regards
Harsha