select
case
when position('xyz' in col1) > 0
then substr(col1,1,position('xyz' in col1) - 1) || 'abc' || substr(col1,position('xyz' in col1) + character_length('xyz'))
else col1
end as col1_replaced
from
(
select
'this is the replacement xyz string' as col1
) a
;
如果需要设置开始替换的位置,以及次数,以及用sp循环完成。
阅读(1512) | 评论(0) | 转发(0) |