oracle bulk collect forall

 create or replace procedure FAST_UP_TEST is  
    TYPE TARR is table of T_TEST%ROWTYPE;  
    vvrr TARR;  
    CURSOR curr is select * from T_TEST where ADDFLAG='add';  
    begin  
      open curr;  
      loop  
        fetch curr bulk collect into vvrr limit 1000;  
        dbms_output.put_line('增加:'||vvrr.count);  
        forall i in 1..vvrr.count  
          update T_TEST2  
          set TESTTYPE=vvrr(i).TESTTYPE,TESTLEVEL=vvrr(i).TESTLEVEL   
          where TESTNAME=vvrr(i).TESTNAME and TESTID=vvrr(i).TESTID;  
          commit;  
        exit when curr%NOTFOUND;  
      end loop;  
      close curr;  
    end;  

 

posted @ 2020-05-08 20:15  shu'sblog  阅读(131)  评论(0编辑  收藏  举报