Subject Re: [firebird-support] Re: Problem with CASE.
Author João Luiz
You do it right.

I try to repeat your steps.
Created a new database, a new table, insert 2 record, and try to "case" it.

Got the same error. =[


From: emb_blaster
Sent: Monday, August 23, 2010 12:06 PM
To: firebird-support@yahoogroups.com
Subject: [firebird-support] Re: Problem with CASE.



--- In firebird-support@yahoogroups.com, João Luiz <jll.listas@...> wrote:
>
> Sure dude.
>
> Here we go.
>
> CREATE TABLE MOVIMENTACAO
> (
> ID Integer NOT NULL,
> TIP_ID Integer,
> PRO_ID Integer,
> FUN_ID Integer,
> DATA Date,
> QTD Integer,
> VOLUMES Integer,
> INS_EMBAL Char(1),
> INS_FISC Char(1),
> INS_INJE Char(1),
> INS_IDENT Char(1),
> INS_OLEO Char(1),
> NF Varchar(30),
> LOTE Integer,
> CONSTRAINT PK_MOVIMENTACAO PRIMARY KEY (ID)
> );
>
> GRANT DELETE, INSERT, REFERENCES, SELECT, UPDATE
> ON MOVIMENTACAO TO "ADMIN";
>
> GRANT DELETE, INSERT, REFERENCES, SELECT, UPDATE
> ON MOVIMENTACAO TO SYSDBA WITH GRANT OPTION;

Hi

I've tried with this data below in Firebird 2.0.6 and got NO errors in IBExpert 2010.07.26. The selects used are below too:

SET NAMES WIN1252;

INSERT INTO MOVIMENTACAO (ID, TIP_ID, PRO_ID, FUN_ID, DATA, QTD, VOLUMES, INS_EMBAL, INS_FISC, INS_INJE, INS_IDENT, INS_OLEO, NF, LOTE) VALUES (69, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO MOVIMENTACAO (ID, TIP_ID, PRO_ID, FUN_ID, DATA, QTD, VOLUMES, INS_EMBAL, INS_FISC, INS_INJE, INS_IDENT, INS_OLEO, NF, LOTE) VALUES (70, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO MOVIMENTACAO (ID, TIP_ID, PRO_ID, FUN_ID, DATA, QTD, VOLUMES, INS_EMBAL, INS_FISC, INS_INJE, INS_IDENT, INS_OLEO, NF, LOTE) VALUES (75, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO MOVIMENTACAO (ID, TIP_ID, PRO_ID, FUN_ID, DATA, QTD, VOLUMES, INS_EMBAL, INS_FISC, INS_INJE, INS_IDENT, INS_OLEO, NF, LOTE) VALUES (76, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO MOVIMENTACAO (ID, TIP_ID, PRO_ID, FUN_ID, DATA, QTD, VOLUMES, INS_EMBAL, INS_FISC, INS_INJE, INS_IDENT, INS_OLEO, NF, LOTE) VALUES (73, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO MOVIMENTACAO (ID, TIP_ID, PRO_ID, FUN_ID, DATA, QTD, VOLUMES, INS_EMBAL, INS_FISC, INS_INJE, INS_IDENT, INS_OLEO, NF, LOTE) VALUES (74, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO MOVIMENTACAO (ID, TIP_ID, PRO_ID, FUN_ID, DATA, QTD, VOLUMES, INS_EMBAL, INS_FISC, INS_INJE, INS_IDENT, INS_OLEO, NF, LOTE) VALUES (77, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO MOVIMENTACAO (ID, TIP_ID, PRO_ID, FUN_ID, DATA, QTD, VOLUMES, INS_EMBAL, INS_FISC, INS_INJE, INS_IDENT, INS_OLEO, NF, LOTE) VALUES (78, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO MOVIMENTACAO (ID, TIP_ID, PRO_ID, FUN_ID, DATA, QTD, VOLUMES, INS_EMBAL, INS_FISC, INS_INJE, INS_IDENT, INS_OLEO, NF, LOTE) VALUES (80, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO MOVIMENTACAO (ID, TIP_ID, PRO_ID, FUN_ID, DATA, QTD, VOLUMES, INS_EMBAL, INS_FISC, INS_INJE, INS_IDENT, INS_OLEO, NF, LOTE) VALUES (81, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO MOVIMENTACAO (ID, TIP_ID, PRO_ID, FUN_ID, DATA, QTD, VOLUMES, INS_EMBAL, INS_FISC, INS_INJE, INS_IDENT, INS_OLEO, NF, LOTE) VALUES (82, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO MOVIMENTACAO (ID, TIP_ID, PRO_ID, FUN_ID, DATA, QTD, VOLUMES, INS_EMBAL, INS_FISC, INS_INJE, INS_IDENT, INS_OLEO, NF, LOTE) VALUES (83, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO MOVIMENTACAO (ID, TIP_ID, PRO_ID, FUN_ID, DATA, QTD, VOLUMES, INS_EMBAL, INS_FISC, INS_INJE, INS_IDENT, INS_OLEO, NF, LOTE) VALUES (84, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO MOVIMENTACAO (ID, TIP_ID, PRO_ID, FUN_ID, DATA, QTD, VOLUMES, INS_EMBAL, INS_FISC, INS_INJE, INS_IDENT, INS_OLEO, NF, LOTE) VALUES (85, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO MOVIMENTACAO (ID, TIP_ID, PRO_ID, FUN_ID, DATA, QTD, VOLUMES, INS_EMBAL, INS_FISC, INS_INJE, INS_IDENT, INS_OLEO, NF, LOTE) VALUES (86, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);

COMMIT WORK;

Query:
select id, case id when 80 then 'oi' end as caso from movimentacao;
select tip_id, case tip_id when 1 then 'oi' end as caso from movimentacao;

Do you think i missed something?





[Non-text portions of this message have been removed]