星期四, 6月 20, 2013

[PLSQL] 每十筆delete 資料的做法~ FYI

spool del_usr_tab.log
sqlplus "/ as sysdba" <<EOF
set timing on
set time on
set serverout on
DECLARE
     v_counter number:=0;
   BEGIN
   for v_number in 1..100000 loop
         delete from test.users where DATE < '20130301' ;
         if (  MOD(v_number ,10 )  = 0 ) then         
           commit;
            DBMS_OUTPUT.PUT_LINE( sysdate);
        end if;
     end loop;
   END;
/
commit;
EOF

沒有留言:

LinkWithin-相關文件

Related Posts Plugin for WordPress, Blogger...