Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2003
    Location
    Netherlands
    Posts
    4

    Question Unanswered: 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

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1

    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 ...;

  3. #3
    Join Date
    Jun 2003
    Location
    Netherlands
    Posts
    4

    Thumbs up

    Thank you very much Tony..

    You have been most usefull (again)

  4. #4
    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

  5. #5
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •