Home » SQL & PL/SQL » SQL & PL/SQL » Fetching Errors in a Table
Fetching Errors in a Table [message #36502] Fri, 30 November 2001 07:54 Go to next message
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 Go to previous message
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;

----------------------------------------------------------------------
Previous Topic: insert using a view
Next Topic: how use the if condition to check inputs in pl sql
Goto Forum:
  


Current Time: Thu Mar 28 19:46:18 CDT 2024