Subject RE: [ib-support] CASE statements
Author Thomas Steinmaurer
Helen,

> >Are you sure? CASE in Firebird 1.5 PSQL works for me.
>
> Hmmm, I don't think Daniel meant you couldn't use SELECT..CASE inside a
> SP. But there isn't a CASE flow-of-control structure implemented as a PSQL
> extension.

The following stored procedure is compilable and works as expected
(regarding the case statement)

SET TERM ^^ ;
CREATE PROCEDURE SP_INSERTDUPLDATE (AID Numeric(18,0))
AS
declare variable i integer;
begin
i = case aid when 1 then 0 when 2 then 1 when 3 then -1 else -100 end;
insert into dupltest (id) values (:i);
when sqlcode -803 do begin
/* Violation of PRIMARY or UNIQUE KEY constraint */
end
end
^^
SET TERM ; ^^


Regards,
Thomas.