在Oracle SQL中识别并附加前缀到字符串

问题描述 投票:0回答:1

我有一个description列,其中数据存储为Hello I’m new to this organisation please guide

我的输出应该是 - Hello I’m new to this marketing organisation please guide

我需要在组织之前追加营销

sql oracle
1个回答
1
投票

假设“组织”只出现一次 - 或者如果所有出现都应该被替换 - 那么最简单的方法是replace()

select replace(col, 'organization', 'marketing organization')

如果“组织”可能出现不止一次,那么您可以使用regexp_replace(),它可以让您更好地控制替换哪个“组织”。但是,您的问题表明“组织”只出现一次。

© www.soinside.com 2019 - 2024. All rights reserved.