oracle forall

select * bulk collect
    into r_115
    from TZTJ_CL0115
   where nf = v_nf
     and yf = v_yf
     and dwbm = '1'
     and lb = '项目';
  for i in 1 .. r_115.count loop
    select *
      into r_tzkt
      from tztj_tz_kt
     where nf = v_nf
       and yf = v_yf
       and xmid = r_115(i).xmid;
 
    r_115(i).col53 := r_tzkt.zygzl_ew;
    r_115(i).col54 := r_tzkt.zygzl_sw;
    r_115(i).col55 := r_tzkt.zygzl_ytjks;
    r_115(i).col56 := r_tzkt.zygzl_ytjjc;
    --r_115(i).col57 := r_tzkt.erp_hj;
    --r_115(i).col58 := r_tzkt.erp_wht_xj;
    --r_115(i).col58 := r_tzkt.erp_wht_xj;
    r_115(i).col60 := r_tzkt.erp_hj;
    r_115(i).col61 := r_tzkt.erp_wht_xj;
    r_115(i).col62 := r_tzkt.erp_zj_ytj;
    r_115(i).col70 := r_tzkt.tzwc_hj;
    r_115(i).col71 := r_tzkt.tzwc_wht_xj;
    r_115(i).col72 := r_tzkt.tzwc_zj_ytj;
  end loop;
  delete from tztj_cl0115
   where nf = v_nf
     and yf = v_yf
     and lb = '项目';
  forall i in 1 .. r_115.count
    INSERT INTO tztj_cl0115 VALUES r_115 (i);
  commit;

原文地址:https://www.cnblogs.com/sddychj/p/5850112.html