我在不同位置的列中有数据,我想使用regexp_replace()
替换。
列值:
业务解决方案,管理服务,信用管理服务, 商业解决方案,信用
在列中,我想用业务解决方案替换业务解决方案。
请指导
答案 0 :(得分:1)
有帮助吗?
SELECT
REGEXP_REPLACE('Business solution, Business solutions, management services, credit Management services, business solution, credit'
,
'(^|[^[:alpha:]])business solution([^[:alpha:]]|$)','\1business solutions\2', 1, 0, 'i')
from
DUAL;
答案 1 :(得分:0)
您可以通过两种方式使用regexp_replace
。
区分大小写的方式:
通过将SQL> SQL> SELECT 2 REGEXP_REPLACE('Business solution, management services, credit Management services, business solution, credit' 3 , 'business solution' 4 , 'business solutions') 5 FROM 6 DUAL; REGEXP_REPLACE('BUSINESSSOLUTION,MANAGEMENTSERVICES,CREDITMANAGEMENTSERVICES,BUSINESSSOLUTION, ---------------------------------------------------------------------------------------------- Business solution, management services, credit Management services, business solutions, credit SQL>
match_parameter
用作'i'
不区分大小写的方式
SQL> SQL> SELECT 2 REGEXP_REPLACE('Business solution, management services, credit Management services, business solution, credit' 3 , 'business solution' 4 , 'business solutions', 1, 0, 'i') 5 FROM 6 DUAL; REGEXP_REPLACE('BUSINESSSOLUTION,MANAGEMENTSERVICES,CREDITMANAGEMENTSERVICES,BUSINESSSOLUTION,C ----------------------------------------------------------------------------------------------- business solutions, management services, credit Management services, business solutions, credit SQL>
干杯!