oracle 10g 使用更新和连接
oracle 10g using update and concat
我的table结构是这样的。
gno gdate DCNo DCDATE
g/1 11/12/2018 cnt/1 12/12/2018
g/2 20/12/2018 cnt/2 13/12/2018
g/3 11/12/2018 3 11/12/2018
g/4 10/12/2018 4 10/12/2018
我想用 cnt/no 更新 dcno 中的所有列。这里第 3 行和第 4 行必须更新为 cnt/3 和 cnt/4
这是你想要的吗?
update t
set DCNO = 'cnt/' || DCNO
where DCNO not like 'cnt/%';
试试这个
update tablename set dcno='cnt/'||dcno
where dcnot not like 'cnt/%'
用例
update table
set DCNo= case when DCNo in ('3','4')then 'cnt/'||DCNO end
我的table结构是这样的。
gno gdate DCNo DCDATE
g/1 11/12/2018 cnt/1 12/12/2018
g/2 20/12/2018 cnt/2 13/12/2018
g/3 11/12/2018 3 11/12/2018
g/4 10/12/2018 4 10/12/2018
我想用 cnt/no 更新 dcno 中的所有列。这里第 3 行和第 4 行必须更新为 cnt/3 和 cnt/4
这是你想要的吗?
update t
set DCNO = 'cnt/' || DCNO
where DCNO not like 'cnt/%';
试试这个
update tablename set dcno='cnt/'||dcno
where dcnot not like 'cnt/%'
用例
update table
set DCNo= case when DCNo in ('3','4')then 'cnt/'||DCNO end