1

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

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.