Equivalent for db2 Chr function to handle line feed and tab

Database

Equivalent for db2 Chr function to handle line feed and tab

We have code in db2 where it is replace particular pattern with line feed and tab using chr function. How to acheive the same in Teradata. In teradata i know we have oreplace function, but how to handle chr ?

set V_TEXT = replace (V_TEXT, 'abc;', chr(10)) ;

set V_TEXT = replace (V_TEXT, 'def9;', chr(9)) ;

set V_TEXT = replace (V_TEXT, ''', '''') ;
2 REPLIES
N/A

Re: Equivalent for db2 Chr function to handle line feed and tab

set V_TEXT = oreplace (V_TEXT, 'abc;', '0a'XC) ;

set V_TEXT = oreplace (V_TEXT, 'def9;', '09'XC);

XC is hexadecimal value as a character

Re: Equivalent for db2 Chr function to handle line feed and tab

I tried this , but it teradata for chr(10) and (9) , its just converting it as blank spcae ' '

******* DB2 **********
db2 " select cast(replace ('rahul','h',chr(10)) as char(20))||cast(replace ('rahul','h',chr(9)) as char(20)) as a from dual "
A
----------------------------------------
ra
ul ra ul

1 record(s) selected.

******** TD ************

sel cast (oreplace ('rahul','h','0a'XC ) as char(20)) || cast (oreplace ('rahul','h', '09'XC) as char(20)) as A;
*** Query completed. One row found. One column returned.
*** Total elapsed time was 1 second.
A
----------------------------------------
ra ul ra ul