Yas*_*ash 0 sql database oracle replace lowercase
我正在搜索模式“hello world”并替换为 Hello Bob。
这里我想匹配hello world的所有模式。问题是我们无法在替换函数中匹配这两种模式。所以我把它降低并更换。
结果,它使整个字符串变为小写。“这是你好鲍勃程序!这是你好鲍勃程序”
但我希望它是“这是你好鲍勃程序!。这是你好鲍勃程序”
这是查询:
select replace(lower('This is Hello World Program!. This is hello world Program'),lower('Hello world'),'Hello Bob') from dual;
有什么建议请
小智 6
您收到的结果全部为小写,因为您正在LOWER对源字符串执行该函数。REPLACE您可以使用REGEXP_REPLACE而不是使用,因为该函数能够忽略大小写。
SELECT REGEXP_REPLACE ('This is Hello World Program!. This is hello world Program',
'Hello world',
'Hello Bob',
1,
0,
'i')
FROM DUAL;
Run Code Online (Sandbox Code Playgroud)