Subject Re: [firebird-support] How can I correctly write this WHERE
Author Mark Rotteveel
On 19-6-2018 13:54, Svein Erling Tysvær setysvar@...
[firebird-support] wrote:
>
>
> Hi Bhavbhuti!
>
> According to https://firebirdsql.org/refdocs/langrefupd15-case.html
>
> this is how case is written:
>
> CASE <expression>
>    WHEN <exp1> THEN result1
>    WHEN <exp2> THEN result2
>    ...
>    [ELSE defaultresult]
> END
> and definitely not
>
> CASE <expression>
>    WHEN <exp1> THEN comparison
>    WHEN <exp2> THEN comparison2
>    ...
>    [ELSE defaultcomparison]
> END

Whether it works depends on the Firebird version. With Firebird 2.5 and
earlier it won't work, but with Firebird 3 using a comparison after the
THEN in a CASE will work, as a comparison is an expression with a
boolean result, which leads to the CASE having a boolean result (which
is not supported in earlier versions), which means it can be used as a
condition in the WHERE-clause

Mark
--
Mark Rotteveel