Subject | COALESCE |
---|---|
Author | Tim Ward |
Post date | 2016-03-17T15:31:30Z |
So I'm getting errors when there's a call to COALESCE with only a single
parameter. (Why would we write code like that? - because nobody thought
to spot it as a special case in our query generation code, perhaps.)
So what does the Firebird book say? - well, my copy appears to say
COALESCE (value 1> { , value 2 [, ...value n })
where {} indicates "mandatory", so it looks like there must be at least
two parameters, so our query generation code is wrong.
Jolly good. So why am I pointing this out? (Other than that if the
designer of the syntax for COALESCE had considered the possibility of
machine-generated code they might have reached a different decision
about the second parameter, or even the first, being mandatory?)
I'm just pointing out the typo in the book - there's no closing square
bracket in that definition.
--
Tim Ward
parameter. (Why would we write code like that? - because nobody thought
to spot it as a special case in our query generation code, perhaps.)
So what does the Firebird book say? - well, my copy appears to say
COALESCE (value 1> { , value 2 [, ...value n })
where {} indicates "mandatory", so it looks like there must be at least
two parameters, so our query generation code is wrong.
Jolly good. So why am I pointing this out? (Other than that if the
designer of the syntax for COALESCE had considered the possibility of
machine-generated code they might have reached a different decision
about the second parameter, or even the first, being mandatory?)
I'm just pointing out the typo in the book - there's no closing square
bracket in that definition.
--
Tim Ward