Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Replacing multiple spaces with a single space

967562Feb 5 2013 — edited May 16 2013
Hi friends,

I have a string. It can have zero/one/multiple spaces. I want to make the multiple spaces to single space.

Here are the cases:

1. ' a b c d efg h' should be changed to 'a b c d e f g h'
2. ' a b c d e f g h ' should be changed to 'a b c d e f g h'
3. 'a b c d e f g h' should not be changed
4. 'abcdefgh' should not be changed

Both REPLACE and TRANSLATE do not help. I don't want to go for LOOP logic. Please help me to get it in SQL query.

Thanks in advance!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 13 2013
Added on Feb 5 2013
11 comments
30,699 views