Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

correcting/replacing substrings 2

Status
Not open for further replies.

roedelfroe

Programmer
Jan 7, 2004
30
DE
Hi,

following problem:

I want to correct emai-addresses in a column:

Now:

Scott.Tiger@anycompanyintheworld.com

Should be:

Scott.Tiger@anycompanyworld.com

Any Ideas how to do this?

Thx in advance

Roland
 
Doesn't:

Update <table>
set <column> = NewValue
where <column> = OldValue

do the trick?
 
O.K., I see I have to a little bit more in detail:

I've got a table with about 18.000 email-addresses.

Table (now):

ID email Dept max.logon
1 scott.tiger@anycompanyintheworld.com 10 5
2 Joe.Brown@anycompanyintheworld.com 15 5
3 Peter.Mulder@anycompanyintheworld.com 15 3
4 John.Edwards@anycompanyintheworld.com 10 5

Table (should be):

ID email Dept max.logon
1 scott.tiger@anycompanyworld.com 10 5
2 Joe.Brown@anycompanyworld.com 15 5
3 Peter.Mulder@anycompanyworld.com 15 3
4 John.Edwards@anycompanyworld.com 10 5

As you can see, a simple update isn't possible. Up to the @ sign, the string varies, after the @ sign, I've got exactly one string (@anycompanyintheworld.com) which I could identify and change.

But obviously,

Update table set email = '%@anycompanyworld.com'
where email = '%@anycompanyintheworld.com'

woud'nt work.

So, again the question: Any ideas how to do this?

Thx in advance

Roland
 
I see now. Try a keyword search for substring in this forum - there are plenty of examples.
 
Specifically,

Code:
update mytable set email =
    translate(email,'anycompanyintheworld','anycompanyworld')
    where email like '%anycompanyintheworld%';

Let us know if this resolves your need.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)

Do you use Oracle and live or work in Utah, USA?
Then click here to join Utah Oracle Users Group on Tek-Tips.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top