Subject Re: [firebird-support] sp case statement
Author Alan J Davies
No.
You have some errors in the logic and data types.
You can try this. You will get one record returned for every record in
your table.

CREATE OR ALTER PROCEDURE GET_DATA (
Input_code char(1) )
RETURNS (
Output_code char(1) ) /* you have an integer which will fail */
as
begin
for select
case
when :input_code='A'
then 'A'
when :input_code='B'
then 'B'
else 'C'
end
from table
into :output_code
do suspend;
end


Alan J Davies
Aldis


On 31/10/2012 21:38, Matchey,Brian wrote:
>
>
> Is there a way to achieve the logic I'm trying to accomplish with the
> CASE statement in the WHERE clause below?
>
> CREATE OR ALTER PROCEDURE GET_DATA (
> Input_code char(1) )
> RETURNS (
> Output_code integer )
> as
> begin
> FOR SELECT T.Output_code
> FROM Table T
> WHERE T.Input_code =
> case :Input_code when 'A' then 'A'
> when 'B' then 'B'
> else (('A') or ('B'))
> end
> INTO :Output_code
> DO
> SUSPEND;
> end;
>
> Vertafore
> Unleash your potential
>
> Daniel Raith
> Software Engineer II
> 26550 W. Mondovi St, Eleva, WI 54738
> T 800 433 2550 Ext 2917 | F 805 553 9308 | draith@...
> <mailto:draith%40vertafore.com><mailto:draith@...
> <mailto:draith%40vertafore.com>>
> vertafore.com
>
> [Non-text portions of this message have been removed]
>
>