Archives of the TeradataForum
Message Posted: Thu, 10 Nov 2005 @ 20:11:55 GMT
Subj: | | Re: View column data type |
|
From: | | Fred W Pluebell |
Not quite. It's not CASE versus COALESCE. Either way, you inherit the CHARACTER SET of the first expression; but for COALESCE the first
expression is almost never a literal.
Either rearrange the CASE logic (e.g. negate the conditions) so that the first expression is not a literal string, or "translate" the
literal.
For example, assuming Column2 is CHARACTER SET LATIN:
CASE WHEN Column2 IS NULL THEN '' ELSE Column2 END
=> UNICODE
CASE WHEN Column2 IS NOT NULL THEN Column2 ELSE '' END
=> LATIN [Note that this is similar to what COALESCE(Column2, '')
means.]
CASE WHEN Column2 IS NULL THEN TRANSLATE('' USING UNICODE_TO_LATIN) ELSE
Column2 END
=> LATIN
|