Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
Jean Sagi — — source: Usenet: comp.databases.informix
Because CASE is not supported as a SPL statement, what you write runs on 4GL not SPL.
Use IF ELSE IF... END IF.
If it seems to ugly (and SPL is a shame to me...) and you have some kind of IDS (9.3, 9.4) you can use case in a select statement.
So you can do something like:
LET v_test = 1;
SELECT CASE v_test
WHEN 0 THEN '1'
WHEN 1 THEN '2'
WHEN 2 THEN '3'
WHEN 3 THEN '4'
WHEN 4 THEN '5'
END
INTO v_res
FROM dual -- ;)
...
RETURN v_res
I haven't proved it but something like that could do what yu need.
Chucho!
-----Original Message-----
From: sean.kelsey@moneyline.com (Sean Kelsey)
To: informix-list@iiug.org
Date: 22 Jun 2004 08:13:20 -0700
Subject: CASE statement frustration...
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 0 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;
Jean Sagi
jeansagi@myrealbox.com
jeansagi@netscape.net
sending to informix-list
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.