Fetching Errors in a Table [message #36502] |
Fri, 30 November 2001 07:54  |
urgent
Messages: 4 Registered: November 2001
|
Junior Member |
|
|
I am inserting some 1 lakh Records in a table.While doing so if i come across a record where in one of my cursor fails,in that case i want that it shuld store that particular row number in another table and at the same time also store the Oracle Error(with Number) in that table and then continue inserting other records..
Eg
If my cursor fails at 2000 record then it shuld store the rownumber of that record in a table and also shuld store the Oracle Error with number in the same table.......
please help.........
----------------------------------------------------------------------
|
|
|
Re: Fetching Errors in a Table [message #36503 is a reply to message #36502] |
Fri, 30 November 2001 08:43  |
Suresh Vemulapalli
Messages: 624 Registered: August 2000
|
Senior Member |
|
|
i prefer storing rowid than rownum. create table table1_log with following syntax.
create table table1_log(rid rowid,
err varchar2(500));
declare
cursor c1 is select rowid,col1,col2 from table1;
l_error varchar2(500);
begin
for crec in c1 loop
begin
-- process here
exception
when others then
l_error := sqlerrm;
insert into table1_log values(crec.rowid,l_error);
end;
end loop;
commit;
end;
----------------------------------------------------------------------
|
|
|