生产上批量提交的方式

来源:互联网 发布:java 延时队列 编辑:程序博客网 时间:2024/05/01 22:33
declaretype t_id is table of rowid;v_t_id t_id;cursor c isselect rowid ridfrom bgw.te_instruct_orderwhere custom_weight <> 2 and trade_detail_id in(select id from bgw.te_trade_detail where trade_order_no in (select to_char(orderseqid)from seashell.withdrawworkorderwhere membercode in (10022280707,10021459218,10022171946,10022280767) and status = 9 and banknameid = 492 andrequestdate >= (trunc(sysdate)) - 12 and requestdate <= (sysdate))) order by rid;row_nums int;beginrow_nums := 0;open c;loopfetch c bulk collectinto v_t_id limit 10000;forall i in 1 .. v_t_id.countupdate bgw.te_instruct_order set custom_weight = 2 where rowid = v_t_id(i);commit;row_nums := row_nums + 1;if row_nums mod 1= 0 thendbms_lock.sleep(30);end if;exit when c%notfound;end loop;commit;close c;end;/
每1w条休息3秒
0 0
原创粉丝点击