Subject | Re: [firebird-support] CASE syntax |
---|---|
Author | Helen Borrie |
Post date | 2008-02-24T10:21:03Z |
At 08:48 PM 24/02/2008, you wrote:
UPDATE MY_TABLE SET MY_BOOL =
CASE
WHEN 'T' THEN '1'
ELSE '0'
END; <-- if it's in a script(
And make sure your left single-quotes really are single quotes and not graves (as they are in your posting).
./heLen
>Can anyone explain why this doesn't work? (It is part of a utilityDouble-quotes on the default? Should be DEFAULT 'F'? And if you're running the statement in a script it needs a statement terminator on line 3.
>to sort out disagreement between database versions where one uses T
>and F as boolean values, and the other 1 and 0).
>
>UPDATE MY_TABLE SET MY_BOOL =
> CASE
> WHEN (CAST(MY_BOOL AS VARCHAR(1)) = `T') THEN `1'
> ELSE `0'
> END
>
>The field MY_BOOL is defined with the domain "BOOLEAN", which is
>described as follows;
>
>CREATE DOMAIN "BOOLEAN"
> AS Char(1)
> DEFAULT "F"
>
>FB 2.03.
>
>Under IB_SQL it reports "unexpected end of command" on line 3.
>Under Flamerobin it reports "SQL statement can't be 0."cast? you're reading a CHAR column. Why would you cast it as something else? And wot the 'eck be a varchar(1) anyhows????????
>
>Am I having a "senior" moment here?
UPDATE MY_TABLE SET MY_BOOL =
CASE
WHEN 'T' THEN '1'
ELSE '0'
END; <-- if it's in a script(
And make sure your left single-quotes really are single quotes and not graves (as they are in your posting).
./heLen