update语句问题,更新不一致
BANCS_YYB_BAL 表有500条数据
select c.ACTNO,b.invm_curr_bal from bancs.t_invm_w01 b,BANCS_YYB_BAL c
where b.invm_memb_cust_ac=c.actno and b.INVM_CURRENCY='CNY' and substr(b.INVM_GL_CLASSIFICATION_CODE,13,4) in (select tgt_apcode from tgt_apcode_bancs where tgt_num in ('0019','1002')))
这条语句只有一条记录,
按照道理下面的语句应该只更新一条记录,可却把5000条记录都更新了,不知道为什么
update BANCS_YYB_BAL a set a.bal=(select tb.invm_curr_bal from (select c.ACTNO,b.invm_curr_bal from bancs.t_invm_w01 b,BANCS_YYB_BAL c
where b.invm_memb_cust_ac=c.actno and b.INVM_CURRENCY='CNY' and substr(b.INVM_GL_CLASSIFICATION_CODE,13,4) in (select tgt_apcode from tgt_apcode_bancs where tgt_num in ('0019','1002'))) tb
where tb.actno=a.actno)
下面的语句,始终报错ora-00933,在from的地方,
update BANCS_YYB_BAL a set a.bal=tb.invm_curr_bal
from (select c.ACTNO,b.invm_curr_bal from bancs.t_invm_w01 b,BANCS_YYB_BAL c
where b.invm_memb_cust_ac=c.actno and b.INVM_CURRENCY='CNY' and substr(b.INVM_GL_CLASSIFICATION_CODE,13,4) in (select tgt_apcode from tgt_apcode_bancs where tgt_num in ('0019','1002'))) tb
where tb.actno=a.actno