oracle中Update方法
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了oracle中Update方法相关的知识,希望对你有一定的参考价值。
1、两表(多表)关联update -- 被修改值由另一个表运算而来
update customers a
set city_name=(select b.city_name from tmp_cust_city b where b.customer_id=a.customer_id)
where exists (select 1
from tmp_cust_city b
where b.customer_id=a.customer_id)
实例:
update bd_psndoc
set bd_psndoc.indutydate=(select begindate from (select a.pk_psnbasdoc as pk_psnbasdoc,
max(b.begindate) as begindate
from temp_psnbasdoc a left join hi_psndoc_deptchg b
on a.pk_psnbasdoc=b.pk_psnbasdoc and a.recordnum=b.recordnum
group by a.pk_psnbasdoc) tt where tt.pk_psnbasdoc=bd_psndoc.pk_psnbasdoc)
where exists(select 1 from (select a.pk_psnbasdoc as pk_psnbasdoc,
max(b.begindate) as begindate
from temp_psnbasdoc a left join hi_psndoc_deptchg b
on a.pk_psnbasdoc=b.pk_psnbasdoc and a.recordnum=b.recordnum
group by a.pk_psnbasdoc) tt where tt.pk_psnbasdoc=bd_psndoc.pk_psnbasdoc)
and pk_psncl=‘00015T100000000003M2‘ and indutydate is null
以上是关于oracle中Update方法的主要内容,如果未能解决你的问题,请参考以下文章
mybatis执行批量更新batch update 的方法(oracle,mysql)
mybatis执行批量更新batch update 的方法(oracle,mysql)
oracle Plsql 运行update或者delete时卡死问题解决的方法