Archives of the TeradataForum
Message Posted: Tue, 07 Oct 2008 @ 15:13:13 GMT
Subj: | | Re: BTEQ Export - concatenating null values |
|
From: | | Fred W Pluebell |
When you use a column or expression with a string operator (like concatenation) Teradata will do implicit CAST to VARCHAR if needed. So if
NumCol is numeric, this works:
'A'||NumCol
But when you introduce CASE, including shorthand COALESCE or NULLIF forms, different rules apply; so this is invalid:
'A'||COALESCE(NumCol,'.')
Use explicit CAST to VARCHAR or CHAR:
'A'||COALESCE(CAST(NumCol AS VARCHAR(15)),'.')
You may also need explicit FORMAT, TRIM, etc. to achieve the desired result.
|