I have to compare two columns say A and B. If they change I need to print both the values as old and new values.
But the problem is that the 2nd column is having some extra spaces between the words, so the names are displayed even though the name didn't change >
help me out on this.
I am looking for a SQL query in teradata
Add a comment
|
1 Answer
What's your Teradata release?
In TD14 there's REGEXP_REPLACE, before you might have the oREPLACE UDF installed:
TRIM(REGEXP_REPLACE(x, '( )+',' ',1,0,'c'))
TRIM(OREPLACE(OREPLACE(OREPLACE(x,' ',' '), ' ',' '), ' ',' ')
You can get rid of the TRIM if you don't have leading or trailing blanks.