Replace( ) & Ascii Characters:CHR( ) in Teradata

Database

Replace( ) & Ascii Characters:CHR( ) in Teradata

Hi All,

Is there any function available in Teradata to replace a string with another one?

Also how are the Ascii characters included in string operations in Teradata like in the following Oracle-SQL codes:

* replace(replace(replace(prd_title, chr(9), ''), chr(10), ''), chr(13), '')

* select part_id || CHR(009) || part_name from product_tbl;

Please suggest me the equivalents of the following in Teradata:
replace()
CHR(9)-Tab key
CHR(10)-Enter key
CHR(13)- Carriage Return
1 REPLY
Enthusiast

Re: Replace( ) & Ascii Characters:CHR( ) in Teradata

This will replace the string 'xyz' with the string 'abc'

select
case
when position('xyz' in col1) > 0
then substr(col1,1,position('xyz' in col1) - 1) || 'abc' || substr(col1,position('xyz' in col1) + character_length('xyz'))
else col1
end as col1_replaced
from
(
select
'this is the replacement xyz string' as col1
) a
;

You can use hexadecimal for these equivalents

CHR(9)-Tab key = '09'XC
CHR(10)-Enter key = '0A'XC
CHR(13)- Carriage Return = '0D'XC