When you rollback, everything since your last commit or savepoint will be lost.
I'm guessing you mean you have some form of loop that commits when you've had 50 iterations. e.g.
for i in 1 .. iterations loop
insert into ...
if mod(i, 50) = 0 then
commit;
end if;
end loop;
|
You can avoid this by placing a savepoint before the insert. Then rolling-back to this when you have the exception:
for i in 1 .. iterations loop
savepoint pre_ins;
begin
insert into ...
exception
when dup_val_on_index then
rollback to savepoint;
end;
if mod(i, 50) = 0 then
commit;
end if;
end loop;
Or, if your values come from a select statement:
Get rid of your loop and insert everything in one go! e.g.
insert into table
select * from ...
If you need to bypass exceptions, check out the "log errors" clause:
https://www.youtube.com/watch?v=8WV15BzQIto