Forum Stats

  • 3,816,082 Users
  • 2,259,137 Discussions
  • 7,893,389 Comments

Discussions

Removing Space from string

sandeepgupta_18
sandeepgupta_18 Member Posts: 44 Red Ribbon
edited May 16, 2022 8:22AM in SQL & PL/SQL

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

«1

Answers

This discussion has been closed.