Subject | Re: [firebird-support] Datatypes are not comparable in expression CASE when using TIMESTAMPS |
---|---|
Author | Mark Rotteveel |
Post date | 2013-08-08T16:21:57Z |
On 8-8-2013 15:44, Maya Opperman wrote:
script that creates the table, adds the testdata and includes the query?
My reproduction is:
CREATE TABLE int_date_table
(
intfield INTEGER,
datefield DATE,
timestampfield TIMESTAMP
);
COMMIT;
INSERT INTO INT_DATE_TABLE (INTFIELD, DATEFIELD, TIMESTAMPFIELD)
VALUES (
1, CURRENT_DATE, CURRENT_TIMESTAMP
);
COMMIT;
SELECT CASE WHEN INTFIELD = 1 THEN DATEFIELD ELSE DATEFIELD END
FROM INT_DATE_TABLE a
Result is as expected.
--
Mark Rotteveel
> Hi,I am unable to reproduce it. Could you create a simple reproduction
>
> Is this a bug, or am I missing something?
>
> This works:
> case
> when p.year = 2200 then p.year
> else p.year
> end
>
> This gives error: Datatypes are not comparable in expression CASE
>
> case
> when p.year = 2200 then p.EndDate
> else p.EndDate
> end
>
> All I did is change the field from an integer, to a timestamp.
>
> Firebird 2.5
> ODS 11.2
script that creates the table, adds the testdata and includes the query?
My reproduction is:
CREATE TABLE int_date_table
(
intfield INTEGER,
datefield DATE,
timestampfield TIMESTAMP
);
COMMIT;
INSERT INTO INT_DATE_TABLE (INTFIELD, DATEFIELD, TIMESTAMPFIELD)
VALUES (
1, CURRENT_DATE, CURRENT_TIMESTAMP
);
COMMIT;
SELECT CASE WHEN INTFIELD = 1 THEN DATEFIELD ELSE DATEFIELD END
FROM INT_DATE_TABLE a
Result is as expected.
--
Mark Rotteveel