coalesce + concatenation

Analytics
Fan

coalesce + concatenation

Hello -- I'm trying to export a file from a table using bteq:

SELECT
coalesce(Cat_Generated_Inet_Flag,'') || '|' ||
coalesce(Division_Code,'')

and am getting the error: $
*** Failure 3706 Syntax error: expected something between ')' and '"||"'.

Putting in an alias doesn't improve matters. This runs ok in DB2, so I guess I'm violating something Teradata specific.
I'd be very grateful for an explanation.

Thanks,

Warren
3 REPLIES
Teradata Employee

Re: coalesce + concatenation

try putting brackets around the coalesce statements.

so that your code reads

SELECT
(coalesce(Cat_Generated_Inet_Flag,'')) || '|' ||
(coalesce(Division_Code,''))

Paul
Enthusiast

Re: coalesce + concatenation

If I recall correctly, this issue was fixed in V2R6.1
Fan

Re: coalesce + concatenation

That did the trick. Thanks very much Paul.