We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,285 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Remove Spaces From VARCHAR2 Using REPACE Function

Hi Guys,

I have imported a CSV file into the database and i want to write some functions to ensure that when data is loaded in that all spaces are removed from certain columns.

For Example: In the Phone No column the numbers can appear as follows
07712345678
077 1234 5678
077 12345678
077 12 34 56 78

I want to remove all spaces from the column and have been trying to use the following query;

SELECT replace(PHONE_NO,' ') FROM IMPORTED_DATA_TABLE

However this displays all the results correctly in the results pane, but i want to update the column to remove the spaces. Could someone point me in the right direction or am I going about this the wrong way?

thanks
Dwayne

1
Contributor
1
Reply
18 Minutes
Discussion Span
1 Year Ago
Last Updated
2
Views
Question
Answered
dwayned
Light Poster
31 posts since Apr 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Hi Guys,

Sorry I figured out how to update as below;

UPDATE IMPORTED_DATA_TABLE SET phone_no= replace(phone_no,' ');

thanks anyway.
Dwayne

dwayned
Light Poster
31 posts since Apr 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
Question Self-Answered as of 1 Year Ago

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0560 seconds using 2.65MB