Subject | RE: [ib-support] CASE statements |
---|---|
Author | Thomas Steinmaurer |
Post date | 2003-05-08T10:59:27Z |
Helen,
(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.
> >Are you sure? CASE in Firebird 1.5 PSQL works for me.The following stored procedure is compilable and works as expected
>
> 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.
(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.