Link to home
Start Free TrialLog in
Avatar of Bobby Sandhu
Bobby SandhuFlag for Canada

asked on

commit after insert

hi
i am writing a simple insert into dim_aa(select * from dim_bb)
dim_bb has like 1 million rows i want to commit like every 10000 rows, whtas the best way to do it.
Avatar of Naveen Kumar
Naveen Kumar
Flag of India image

you have to use a loop in pl/sql if you want to do that also.. there should be some column which should act as a key while selecting 10000 records for the insert...

We cannot use rownum <= 10000 because this will bring the same records again and again instead of the next set of 10000 records...

you can do this in many ways... one of the ways can be :

here i have some column called as inserted_flag to find whether records
are inserted into table dim_aa are not.

begin

loop
insert into dim_aa select * from dim_bb where inserted_flag ='N' and rownum <=10000;
exit when sql%rowcount = 0;
update dim_bb set inserted_flag ='Y'
where inserted_flag='N' and rownum <=10000;
commit;
end loop;

end;
/

this is just one way... and there are many ways to do this. Thanks

ASKER CERTIFIED SOLUTION
Avatar of konektor
konektor
Flag of Czechia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bobby Sandhu

ASKER

i guess only way is writing pl/sql ,  one thing where can u see oracle log files
and see how its filing while running query
i know u can see in db2 as it fills up
how can i see in oracle
thanks
are you getting any errors ?

What do you want to see while the pl/sql code is running ?
i am not getting any errors just wanna know where log files are in oracle
and just want to see how often they get filled and then get empty