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!

Removing Space from string

sandeepgupta_18Aug 17 2020 — edited May 16 2022

Hi All ,

I was looking for a help

I have a table city

in this table there is column "City_name"

that contains value like

City_name

 

RUTLAND
Pendleton     
SIERRA
RANDOLPH
YANCEY
PATRICK
DENVER
CALDWELL
SCOTLAND
KEARNEY
PASCO
CATAWBA
LINN
FORT BEND
COLLIN
RIO ARRIBA

Most of these values contains spaces  & New line character

to remove those i used upper(REGEXP_REPLACE(city_name, '[^0-9A-Za-z]', ''))

this worked for every city except where city name like "RIO ARRIBA" this removed the space between RIO and ARRIBA .

is there any way by which we could removed space, and new line character from the last and starting only if there is a space between string that should remain same..

thanks in advance

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 12 2022
Added on Aug 17 2020
13 comments
41,713 views