'Oracle SQL RTRIM and replacing CHR 13,10,160,9 still leaving space at the end [duplicate]
The original query returned result.
It had what looks like two spaces after the period.
I tried RTRIM and it removes ONE of the spaces result.
I then tried to replace the CHR characters with no luck.
rtrim(replace(COLUMN,CHR(13)||CHR(10)||CHR(160)||CHR(9),'')) as FORMATTED_COLUMN
What other things can I try?
Solution 1:[1]
To make your current approach work, you would have to use REGEXP_REPLACE with an alternation:
REGEXP_REPLACE(COLUMN, '[' || CHR(13) || '|' || CHR(10) || '|' || CHR(160) || '|' || CHR(9) || ']+$', '')
If you wanted to use plain REPLACE, then you would have to chain function calls:
RTRIM(REPLACE(REPLACE(REPLACE(REPLACE(COLUMN, CHR(13), ''), CHR(10), ''), CHR(160), ''), CHR(9), ''))
But then the replacements would happen everywhere, and not just at the end of the string.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Tim Biegeleisen |
