Subject Re: [firebird-support] Re: case when .. else ..end
Author Martijn Tonies
> ERROR:
>
> /**************
> The next statement causes the following error:
>
> Invalid token.
> Dynamic SQL Error.
> SQL error code = -104.
> Token unknown - line 11, char 8.
> when.
> *********************************/

Check the syntax of the CASE statment in the Firebird
release notes.

> I tried following way
> FOR SELECT
> MP.RoleID,
> case
> when MP.RoleID = -1 then 'All Users'
> when MP.RoleID = -2 then 'Superuser'
> when MP.RoleID = -3 then 'Unauthenticated Users'
> else R.RoleName
> end
> FROM AAA MP
>
> and also using double quote,

Why would you do that? String literals are ALWAYS
inside single quotes.

Object names CAN be in double quotes.

>
> FOR SELECT
> MP.RoleID,
> case
> when MP.RoleID = -1 then "All Users"
> when MP.RoleID = -2 then "Superuser"
> when MP.RoleID = -3 then "Unauthenticated Users"
> else R.RoleName
> end
> FROM AAA MP

With regards,

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
http://www.upscene.com
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com