1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

Oracle replace function help

Discussion in 'SQL PL/SQL' started by kruitzpola, Oct 7, 2010.

  1. kruitzpola

    kruitzpola Active Member

    Messages:
    8
    Likes Received:
    1
    Trophy Points:
    65
    Hi all

    I need to replace all the values in a table where a certain key is "ABCD.%" to "WXYZ.%"...

    I thought 'replace' would be able to do that. I'm not sure of the syntax though.

    Can somebody please help or suggest another alternative.

    i tried :
    Code (Text):
    select replace ((select "Key" from TABLE where "Key" like 'ABCD.%','ABCD','WXYZ') from dual
    only to get
    error.

    Thanks in advance.
     
  2. olddog

    olddog Active Member

    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    80
    Have you tried,
    select replace ( TABLE_NAME where "Key" like 'ABCD.%','ABCD','WXYZ') from dual;
     
  3. kruitzpola

    kruitzpola Active Member

    Messages:
    8
    Likes Received:
    1
    Trophy Points:
    65
    Yes , i did ..... Thanks anyway....

    I got the issue resolved with the same query.

    Thanks everyone... Next time i'll try harder and then ask you guys...
     
    Sadik likes this.