主要列
yljgid yljgdm
主键 要更新的目标字段
这是我的SQL语句
update tb_dic_hx_yljgzdb t set t.yljgdm=(select j.yljgdm||'360824' from tb_dic_hx_yljgzdb j
where t.yljgdm=j.yljgdm)
where t.yljgdm like 'PT%' and length(yljgdm)<14 and length(yljgdm)>8
报错:ORA-00001 违反唯一约束性条件
------解决方案--------------------
把where 条件改一下,就行了!具体调整如下:
update tb_dic_hx_yljgzdb t set t.yljgdm=(select j.yljgdm
------解决方案--------------------
'360824' from tb_dic_hx_yljgzdb j
where t.yljgdm=j.yljgdm AND t.yljgdm like 'PT%' and length(t.yljgdm)<14 and length(t.yljgdm)>8 )
------解决方案--------------------
update tb_dic_hx_yljgzdb t set t.yljgdm=t.yljgdm
------解决方案--------------------
'360824' where t.yljgdm like 'PT%' and length(t.yljgdm)<14 and length(t.yljgdm)>8