The DECODE()
Oracle function is available as part of the Oracle UDF Library on the Teradata Developer Exchange Downloads section. Otherwise, you are using the DECODE function in your example in the same manner in which the ANSI COALESCE()
function behaves:
COALESCE(t.satisfaction, 'Not Evaluated')
It should be noted that the data types of the COALESCE()
function must be implicitly compatible or you will receive an error. Therefore, t.satisfaction would need to be at least CHAR(13)
or VARCHAR(13)
in order for the COALESCE()
to evaluate. If it is not, you can explicitly cast the operand(s).
COALESCE(CAST(t.satisfaction AS VARCHAR(13)), 'Not Evaluated')
If your use of DECODE()
includes more evaluations than what is in your example I would suggest implementing the UDF or replacing it with a more standard evaluated CASE
statement. That being said, with Teradata 14 (or 14.1) you will find that many of the Oracle functions that are missing from Teradata will be made available as standard functions to help ease the migration path from Oracle to Teradata.