Skip to Main Content

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, Girish.

Asked: October 18, 2006 - 11:39 pm UTC

Last updated: October 19, 2006 - 11:26 am UTC

Version: 9.2

Viewed 1000+ times

You Asked

Hi Tom,
yesterday I asked you a question in a follow up to a question.But i think I was not clear.Let put my question again

I am inserting in a loop as shown below

declare
cursor c1 is
select name from persons;
nCount number:=0;
begin
for r in c1 loop
nCount:=nCount+1;
insert into d values(r.name);

if mod(nCount,100)=0 then ---- Is it going to have performance problems
commit;
end if;
end loop;
exception
when others then
if c1%isopen then
close c1;
end if;
other error handing mechanisms
end

My Questions are:
1.What is performance of this program if inserted rows are something like 30K everyday
2.Is it going to give snapshot too old error
3.What is the bette way of DOING THIS

Thanks & Regards
Girish


and Tom said...

it has data logic problems (what happens when you fail?)

it opens itself up for Ora-1555's (causing a failure of your program, see number 1)

</code> http://asktom.oracle.com/Misc/slow-by-slow.html <code>


for a measely tiny, small, insignificant number of rows like that, if you use anything OTHER that insert into d select name from persons; you have done it wrong


Is this answer out of date? If it is, please let us know via a Comment