D.Loo D.Loo - 1 month ago 18
SQL Question

Trim inner blanks in teradata

How do you trim whitespaces in teradata? Do I need to write a procedure for it?

Answer

OREPLACE can be installed in releases prior to TD 14.x as a UDF from Teradata Dev Exchange, it appeared as a native function around TD 14.0 or TD 14.10:

SELECT OREPLACE(colA, ' ', ''); -- Replace all whitespace, leading and trailing included

or you can use REGEX_REPLACE, if supported by your release of Teradata:

SELECT REGEX_REPLACE(colA, '[@\s+]', '', 1, 0, 'i');
Comments