Posted: Tue Feb 15, 2005 2:07 pm Post subject: CASE Statement -- 2 Conditions
Centurion
Joined: 09 Oct 2002 Posts: 145 Location: Florida
Have a question about the CASE statement. Here is the example from the ESQL Reference:
Code:
CASE size
WHEN 'A' THEN
SET description = ’small’;
WHEN 'B' THEN
SET description = ’medium’;
WHEN 'C' THEN
SET description = ’large’;
ELSE SET description = ’unknown’;
CALL handleError();
END CASE;
WBIMB is spitting when I try to evaluate two values such as:
CASE size
WHEN 'A' OR 'Z' THEN
SET description = ’small’;
WHEN 'B' THEN
SET description = ’medium’;
WHEN 'C' THEN
SET description = ’large’;
ELSE SET description = ’unknown’;
CALL handleError();
END CASE;
Do I have the syntax screwed up or am I reduced to having 2 WHEN statements with the same lines executed?
The example was actually a very simple version and my pseudocode would actually be something along the lines of:
Code:
CASE InputRoot.MRM.Order.Type
WHEN 'DaysExceededHold' or 'CreditHold' THEN
Do a whole bunch of stuff in a database;
WHEN 'Clear' THEN
Log the message and then quit.
WHEN 'Other' THEN
Do different stuff in a database
WHEN lots of other possibilities
END CASE
There is a LOT of code for each possible case. From what you've said here, the best option is to just have a WHEN statement for each Order Type and then just wrap the logic in a function to be called for each of the WHEN clauses.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum