replace '&' in oracle query

Discussion in 'Databases' started by Jamie18, Jan 13, 2010.

  1. #1
    does anyone know how replace or regexp_replace '&' or any other ampersand string?

    my first stab at it was this
    SELECT replace(g.name, '\&', '\&')
    FROM groups g
    Code (markup):
    however oracle considers the & as a special character and when i run the query it asks me for the value of the 'AMP' variable.. if i substitute '&' for that value the replace still doesn't work..

    any ideas?
     
    Jamie18, Jan 13, 2010 IP
  2. Jamie18

    Jamie18 Peon

    Messages:
    201
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Solution:

    SELECT regexp_replace(g.name, '\&'||'amp;', '&')
    FROM groups g
    Code (markup):
     
    Jamie18, Jan 13, 2010 IP