Could anybody shed some light on when to use IF..ELSEIF and SELECT.
Seems to me that the semantics of SELECT is exactly the same as IF..ELSEIF.
SELECT just takes one line more (the SELECT).
Maybe the idea is like this CASE statement. However a "normal" CASE
statement like this selects between different individiual values of a
variable. However, each WHEN statement in a SELECT is a full loagical
expression, hence just the same as IF..ELSEIF.
I use select when i need to condition using one variable. For example:
WHEN X = 1
WHEN X = 2
Would be a much better syntax, which resembles the CASE statement.
I suspect that initially it would be just like a CASE statement, but, IBM
being IBM, and camels and committees.... it ends up as another way of
So better to shun it, and, for simplicities sake, always use IF..ELSEIF. Or
is there a good reason to use SELECT? E.g. to communicate that it is simply
a choice between values like CASE?
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2021 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.