Multiple REPLACE function in Oracle

后端 未结 6 1800
陌清茗
陌清茗 2020-12-05 07:25

I am using the REPLACE function in oracle to replace values in my string like;

 SELECT REPLACE(\'THE NEW VALUE IS #VAL1#\',\'#VAL1#\',\'55\') fr         


        
6条回答
  •  醉话见心
    2020-12-05 08:02

    Even if this thread is old is the first on Google, so I'll post an Oracle equivalent to the function implemented here, using regular expressions.

    Is fairly faster than nested replace(), and much cleaner.

    To replace strings 'a','b','c' with 'd' in a string column from a given table

    select regexp_replace(string_col,'a|b|c','d') from given_table
    

    It is nothing else than a regular expression for several static patterns with 'or' operator.

    Beware of regexp special characters!

提交回复
热议问题