Subject Re: [firebird-support] Digest Number 3896
Author Helen Borrie
First of all, a Moderator grouch: please do not launch threads from
digests. Pick up the Subject of the thread you want to reply to and
replace the Subject in the reply email. This *still* stuffs up the
threading in thread-aware email clients but that's less of a sin.

At 02:58 AM 13/03/2006, you wrote:
>Yes, I know about the CASE construct. I have read the sample in the doc
>files (and in Helen's book), but, as in any other language, you could use a
>CASE in each case (pun intended) you now use an IF.
>
>It's just that an IF would be more logical here (with less code to write).

That's sometimes true, as long as you are writing PSQL and not
constructing a DSQL query. :-) CASE and its relatives (COALESCE,
IIF, NULLIF) were invented for the *purpose* of providing a way to
condition output in dynamic SQL which, of course, doesn't have
conditional control structures like IF, WHILE, etc.

In PSQL, it can be a way to make your code blocks easier for others
to understand and maintain but *also* can reduce the number of
conditional code blocks you are trying to control. This can really
matter in large SPs, since there is an absolute limit of 64 Kb for
the size of a SP or trigger definition.

^heLen