Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Search/Replace function for varchar2(2000) field

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-20-03, 09:07
njitter njitter is offline
Registered User
 
Join Date: Jun 2003
Location: Netherlands
Posts: 4
Question Search/Replace function for varchar2(2000) field

Hello,

i've got a Oracle 8 database that contains a Varchar2(2000) field.
The field holds the definition for a Toolbar.

It looks like this :

---

Search Sample SE˙˙ Next Sample NS˙˙View SampleAuditSAUDIT RG˙ž View Notepad NOTEPAD RG˙˙ Print Screen PR˙˙Previous Sample PS˙˙

---

We switched to a new version of the program (terminal based to windows based) and we need to edit all the descriptions so they will fit on a button.

So 'Search Sample' would become 'Search' and 'Next Sample' would become 'Next'

Is it possible to do a Search-Replace in this database-field?

Regards,

Njit
Reply With Quote
  #2 (permalink)  
Old 06-20-03, 09:31
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 4,874
Re: Search/Replace function for varchar2(2000) field

Yes:

UPDATE t SET col = REPLACE(col,'Search Sample','Sample')
WHERE ...;

You can either repeat with other replacements, or nest them:

UPDATE t SET col = REPLACE(REPLACE(col,'Search Sample','Sample'),'Next Sample','Next')
WHERE ...;
__________________
Tony Andrews
http://tonyandrews.blogspot.com
Reply With Quote
  #3 (permalink)  
Old 06-20-03, 18:28
njitter njitter is offline
Registered User
 
Join Date: Jun 2003
Location: Netherlands
Posts: 4
Thumbs up

Thank you very much Tony..

You have been most usefull (again)
Reply With Quote
  #4 (permalink)  
Old 07-10-03, 20:34
aruneeshsalhotr aruneeshsalhotr is offline
Registered User
 
Join Date: Jul 2003
Location: US
Posts: 314
Exclamation Question

Hi,
I had a similar situation that I wanted to updated my DB, for all the email addressess (internal and private), starting with gggg, and replace the emails with xxx.
I had to do that manually.

update wm_order set email = replace(email,'gggg','xxx');

Instead of only 3 applicable records, it is updating all the records.
I would appreciate your help.

Thanx and Regards
Aruneesh
Reply With Quote
  #5 (permalink)  
Old 07-11-03, 05:57
padderz padderz is offline
Upstart
 
Join Date: Aug 2001
Posts: 66
Re: Question

Some sort of WHERE clause would seem appropriate.
__________________
Padderz
SYSOP, Quest Software / RevealNet Labs PL/SQL Pipeline
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On