RE: CASE statement frustration...
Posted in 2004
Sean Kelsey said:
> Ok, try this version then...
My original reply was going to be: "I've often had gyp with CASE
statements, and I tend to use the form:
CASE
WHEN v_test=1 THEN
LET v_res = '1';
WHEN v_test=2 THEN
LET v_res = '2';
WHEN v_test=3 THEN
LET v_res = '3';
ELSE
LET v_res = 'else';
END CASE;
I tend to do this mostly in SELECTs, as I rarely get to write SPL any more."
> -----Original Message-----
> From: Obnoxio The Clown [mailto:obnoxio@serendipita.com]
> Sent: 22 June 2004 19:07
> To: Sean Kelsey
> Cc: informix-list@iiug.org
> Subject: Re: CASE statement frustration...
>
>
>
> Sean Kelsey said:
>> 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 1 THEN
>> LET v_res = '1';
>> WHEN 2 THEN
>> LET v_res = '2';
>> WHEN 3 THEN
>> LET v_res = '3';
>> ELSE
>> LET v_res = 'else';
>> END CASE;
>>
>> END PROCEDURE;
>
> Errrr.... something is missing in the first "WHEN" clause?
>
> --
> Bye now,
> Obnoxio
>
> "C'est pas parce qu'on n'a rien ' dire qu'il faut fermer sa gueule"
> - Coluche
>
> "I'm trying to see things your way, but I can't get my head up my ass"
> - JCH
>
> "Ogni uomo mi guarda come se fossi una testa di cazzo"
> - Marco
>
> http://www.catb.org/~esr/faqs/smart-questions.html
> #####################################################################
> CONFIDENTIALITY NOTICE
> The information contained in this email is confidential and may also
> be privileged. It is intended to be for the exclusive use of the
> addressee(s) and access to it by any other person is unauthorised.
> If you are not the addressee please note that you must not distribute,
> copy, circulate or in any other way use or rely on the information
> contained in this email. If you have received this email in error
> please notify us by phone (+44 (0)20 7832 9000) and then destroy the
> email and any copies of it.
> ######################################################################
>
--
Bye now,
Obnoxio
"C'est pas parce qu'on n'a rien ' dire qu'il faut fermer sa gueule"
- Coluche
"I'm trying to see things your way, but I can't get my head up my ass"
- JCH
"Ogni uomo mi guarda come se fossi una testa di cazzo"
- Marco
http://www.catb.org/~esr/faqs/smart-questions.html
sending to informix-list