在netezza中不使用正则表达式替换字符串

时间:2016-02-02 05:38:37

标签: sql netezza

有没有办法在不使用正则表达式函数的情况下替换netezza sql中的字符串(即regexp_replace()) 例如: 替换('完美'' FECT''油烟&#39)

TIA

2 个答案:

答案 0 :(得分:2)

如果没有SQL Extensions Toolkit,您可以使用substrinstr函数。您可能需要多次运行它们,具体取决于相关字符串的重复发生。以下是一个例子:

    select substr(a.txt,1,instr(a.txt,'fect')-1)
          ||'fume'
          ||substr(a.txt,instr(a.txt,'fect')+length('fect'),255)
    from (select 'perfect' as txt) a

答案 1 :(得分:1)

如果您安装了SQL Extensions Toolkit,则可以使用:

select sql_functions..replace('prefect', 'fect', 'fume')