MySQL Forums
Forum List  »  Newbie

Re: replace a substring in a table
Posted by: Felix Geerinckx
Date: June 20, 2005 08:00AM

dirk wrote:
> I need to replace part of a sting in a varchar field.
> The field itself contains phone numbers. About
> 1500 of them are formatted like this : +32 (0)51 123456 wheras
> I want them to be like : +32 51 123456. I tried with 'replace' but this only
> replaces an exact match, i.e. the '(0)' thing can be sometimes
> on the fourth or third position in the string.

It doesn't matter where or how many '(0)'-substrings you have: they are all removed if you use

SELECT REPLACE('+32 (0)51 12(0)345(0)', '(0)',''); --> +32 51 12345

--
felix
Please use BBCode to format your messages in this forum.

Options: ReplyQuote


Subject
Written By
Posted
June 20, 2005 07:54AM
Re: replace a substring in a table
June 20, 2005 08:00AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.