Archives of the TeradataForum
Message Posted: Tue, 19 Jul 2005 @ 14:58:43 GMT
Subj: | | Re: COALESCE or CASE ? |
|
From: | | Anomy Anom |
<-- Anonymously Posted: Tuesday, July 19, 2005 10:54 -->
The thread cited as evidence that there may be "subtle differences" between CASE and COALESCE says nothing of the sort. It merely states that
"a" CASE statement didn't work while "a" COALESCE did. Note that there IS a "subtle difference" between the equivalent of COALESCE
CASE WHEN C.COL1 IS NOT NULL THEN C.COL1 ELSE P.COL1 END
and the CASE statement suggested by the OP in this thread
CASE WHEN C.COL1 IS NULL THEN P.COL1 ELSE C.COL1 END
Beyond the obvious (reversing the NULL test), the datatype of the CASE statement is determined by the first THEN expression, which could
cause implicit CAST or TRANSLATE to be invoked in one case and not the other.
|