SQL 4 Oracle 오라클용 sql 실무

카테고리 없음

PLSQL로 일괄처리 하기

돌프1 2023. 3. 10. 13:37

2011-08-02 14:12:43


SQL 4 Oracle 오라클용 sql 실무

▒ PLSQL로 일괄처리 하기

 

declare
    find_CNT  number := 0;
    cursor cg_cursor is
       select COL1 from 타겟_Table  ;
begin
    for box in cg_cursor loop
          UPDATE 타겟_Table SET LGR_MDF_DT='20110701'
          WHERE COL1 = box.COL1 ;
         
           find_CNT  := find_CNT + 1;
           if mod(find_CNT,1000) = 0 then
            commit;
           -- dbms_output.put_line('** Updating COUNT : '|| find_CNT);
           end if;
    end loop;
    commit;
    -- dbms_output.put_line('** Total Update COUNT==> '|| find_CNT);
end;