日期:2014-05-17 浏览次数:21080 次
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)--这个条件是否会有一个actno对应多个invm_curr_bal?看不到数据,应该是条件没限制住 看看能否在加个其他条件在限制一下?
------解决方案--------------------
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)
这条语句相当于对整个BANCS_YYB_BAL 进行修改,后面还需要增加where条件