Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Case Statement

Former Member
0 Likes
617

Is it possible to write a case statement like the following:

Case table_size.

when 0.

when > 0 and < 1000.

when > 1000 and <2000.

when others.

endcase.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
590

No, you can not. You have to write If statement in this case.

Regards,

Satish

4 REPLIES 4
Read only

Former Member
0 Likes
591

No, you can not. You have to write If statement in this case.

Regards,

Satish

Read only

Former Member
0 Likes
590

No, I don't think you can use CASE like this

Instead you need to go for IF

-Pavan

Read only

0 Likes
590

You can not use the ">" or "<" symbols in the Case statements, they are unknown and will be treated like a field thats been defined by a data statement. Its simply easier to use the conditional IF/ELSE/ENDIF statements when dealing with ranges.

Read only

JozsefSzikszai
Active Contributor
0 Likes
590

you have to use IF ... :

IF tablesize EQ 0.

...

ELSEIF tablesize GT 0 AND tablesize LT 1000.

...

ELSEIF ...

ENDIF.

hope this helps

ec