Toad World® Forums

CASE Statement

I cannot seem to get a CASE WHEN statement to work with Toad Data Point. I keep getting the error ‘Unrecognized keyword WHEN’. Can anyone help please???

SELECT CASE ‘LOAN TYPE’

WHEN = ‘P’ THEN ‘PLUS’

ELSE ‘YYYYYYY’ END AS LOANTYPE

FROM TABLE

;

Remove the ‘=’ to make it work.

I structure CASE statement as follows:

SELECT CASE WHEN ‘LOAN TYPE’ = ‘P’ THEN ‘PLUS’

ELSE ‘YYYYYYY’ END AS LOANTYPE

FROM TABLE;

Still not working. Can I not use the Case statement with the Toad Data Point as Access for the database?

When the connection is to Access, the case statement needs to be written in “Access” language. Try:

select iif(‘LOAN TYPE’ = ‘P’,‘PLUS’,‘YYYYYY’) as LOANTYPE

from TABLE

For a connection type that is Access, the Case statement should be written in “Access” language:

Try:

select iif(‘LOAN TYPE’ = ‘P’,‘PLUS’,‘YYYYYY’) as LOANTYPE

FROM TABLE

If you run your query against Access then you may need to use IIF() function insted of Case