Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

COMMIT after every 10000 rows

RadhakrishnaSarmaFeb 23 2006 — edited Feb 24 2006

I'm getting probelms with the following procedure. Is there any that I can do to commit after every 10,000 rows of deletion? Or is there any other alternative! The DBAs are not willing to increase the undo tablespace value!

create or replace procedure delete_rows(v_days number)
is
l_sql_stmt varchar2(32767) := 'DELETE TABLE_NAME WHERE ROWID IN (SELECT ROWID FROM TABLE_NAME W
';
where_cond VARCHAR2(32767);
begin
   where_cond := 'DATE_THRESHOLD < (sysdate - '|| v_days ||' )) ';
   l_sql_stmt := l_sql_stmt ||where_cond;
   IF v_days IS NOT NULL THEN
       EXECUTE IMMEDIATE l_sql_stmt;
   END IF;
end;

I think I can use cursors and for every 10,000 %ROWCOUNT, I can commit, but even before posting the thread, I feel i will get bounces! ;-)

Please help me out in this!

Cheers
Sarma!

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 24 2006
Added on Feb 23 2006
11 comments
10,431 views