RE: CASE statement frustration...
Posted in 2004
Would a decode work?
select decode(v_test,
0, 1,
1, 2,
2, 3,
'else') as v_test
from table_a;
At least that's what my foggy memory says the code would be like.
John David Adamski
Information Systems Specialist
Graceland University
-----Original Message-----
From: owner-informix-list@iiug.org [mailto:owner-informix-list@iiug.org]
On Behalf Of TBP
Sent: Wednesday, June 23, 2004 7:16 AM
To: informix-list@iiug.org
Subject: Re: CASE statement frustration...
Obnoxio The Clown wrote:
> June C. Hunt said:
>
>>Sean Kelsey wrote:
>>
>>>IDS 9.40.TC4 (on Windows 2000 Advanced Server)
>>>
>>>
>>>Afternoon all...
>>>
>>>Can anyone tell me why the folloiwng CASE statement embedded within a
>>>SPL won't work? Its really bugging me.
>>>
>>>TIA.
>>>
>>>Sean.
>>>
>>>CREATE PROCEDURE MIS_DoTest()>>>
>>> DEFINE v_test INTEGER;
>>> DEFINE v_res VARCHAR(12);
>>>
>>> LET v_test = 1;
>>> LET v_res = '0';
>>>
>>> CASE v_test
>>> WHEN THEN
>>> LET v_res = '1';
>>> WHEN 1 THEN
>>> LET v_res = '2';
>>> WHEN 2 THEN
>>> LET v_res = '3';
>>> ELSE
>>> LET v_res = 'else';
>>> END CASE;
>>>
>>>END PROCEDURE;
>>
>>Unless I am misreading the documentation, CASE within an SPL is only
>>available in XPS (not IDS).
>>
>>Am I misreading that?
>
>
> As The Big Potatoe might say: Hummm, no you don't seem to be
> misreading it. :o)
>
Hummm, no you don't seem to be misreading it. (*XPS* only)
sending to informix-list