Hello. I'm trying to figure out why I'm getting this error, which seems to be connected to the case/when statement but it runs fine in Toad. ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, *, **, +, ',', -, /, <, <=, <>, =, >, >=, ?, AND, AS, CONTAINS, EQ, EQT, FROM, GE, GET, GT, GTT, LE, LET, LIKE, LT, LTT, NE, NET, OR, ^=, |, ||, ~=. select i.CUSTOMER_ACCOUNT_KEY,i.SITE_ID, i.SITE_DESC, i.CUSTOMER_KEY, i.ACCOUNT_NUMBER, i.CUSTOMER_NAME, i.HOME_AREA_CODE, i.HOME_PHONE_NUMBER,i.CUSTOMER_STATUS_CODE, case when a.CUSTOMER_CATEGORY_CODE = 'T' then 'Test' else 'Customer' end CUST_CAT_CODE, case CUSTOMER_TYPE_CODE when 'V' then 'Employee' when '4' then 'Memo' when '5' then 'Memo' when 'I' then 'Internal' else 'Default' end CUST_TYPE_CD, e.EQUIPMENT_STATUS_DESC, e.ITEM_NBR, e.ITEM_DESC, e.ICOMS_SERIAL_NBR, e.START_DT_KEY, e.END_DT_KEY, case END_DT_KEY when 99991231 then 'N' else 'Y' end SWAP_STATUS from CM.ALL_INDIVIDUALS i join CM.ALL_ACCOUNTS a on i.CUSTOMER_ACCOUNT_KEY = a.CUSTOMER_ACCOUNT_KEY join CM.ALL_CUST_EQUIPMENT e on i.CUSTOMER_ACCOUNT_KEY = e.CUSTOMER_ACCOUNT_KEY where ITEM_NBR in ('MPX032','CPX032') AND e.END_DT_KEY > 20180401 AND --CUSTOMER_TYPE_CODE = '%Default%' and --i.SITE_ID in (1, 334, 541, 333, 334 ) AND --e.EQUIPMENT_STATUS_DESC = 'INSTALLED AT CUSTOMER' i.CUSTOMER_ACCOUNT_KEY IN('1051947001', '1008410505') order by end_dt_key DESC --and a.CUSTOMER_CATEGORY_CODE = 'Customer' --AND e.END_DT_KEY = 99991231; --------------------------------------------------------------- Error: 26 case 27 when a.CUSTOMER_CATEGORY_CODE = 'T' 28 then 'Test' 29 else 'Customer' 30 end CUST_CAT_CODE, _____________ 22 ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, *, **, +, ',', -, /, <, <=, <>, =, >, >=, ?, AND, AS, CONTAINS, EQ, EQT, FROM, GE, GET, GT, GTT, LE, LET, LIKE, LT, LTT, NE, NET, OR, ^=, |, ||, ~=. 31 32 case CUSTOMER_TYPE_CODE 33 when 'V' ____ 22 ERROR 22-322: Syntax error, expecting one of the following: ;, ',', ANSIMISS, CROSS, EXCEPT, FULL, GROUP, HAVING, INNER, INTERSECT, JOIN, LEFT, NATURAL, NOMISS, ORDER, OUTER, RIGHT, UNION, WHERE. 34 then 'Employee' 35 when '4' 33 when 'V' ____ 76 ERROR 76-322: Syntax error, statement will be ignored.
... View more