aaa;bbb;ccc;efef;sfsfs
要update为这样:
010_aaa;010_bbb;010_ccc;010_efef;010_sfsfs
语句如何实现呢?
4 个解决方案
#1
update 表1 t set t.列1=replace((select 列1from 表1 a where a.主键列=t.主键列) , ';' , '-' )
#2
with m as (
select 'aaa;bbb;ccc;efef;sfsfs' c from dual
)
select '010_' || replace(c,';',';010_') r , c from m ;
#3
UPDATE tablename SET Col=CONCAT('010_',REPLACE(Col,';',';010_'))
#4
#1
update 表1 t set t.列1=replace((select 列1from 表1 a where a.主键列=t.主键列) , ';' , '-' )
#2
with m as (
select 'aaa;bbb;ccc;efef;sfsfs' c from dual
)
select '010_' || replace(c,';',';010_') r , c from m ;
#3
UPDATE tablename SET Col=CONCAT('010_',REPLACE(Col,';',';010_'))