If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
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, 08: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, 08:31
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 5,171
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://tinyurl.com/tonyandrews
Reply With Quote
  #3 (permalink)  
Old 06-20-03, 17: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, 19: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, 04:57
padderz padderz is offline
Registered User
 
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

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