Home » SQL & PL/SQL » SQL & PL/SQL » Disregard errors in inserting records
Disregard errors in inserting records [message #3044] Mon, 02 September 2002 00:32 Go to next message
Marjorin Mendoza
Messages: 15
Registered: September 2002
Junior Member
Is there a way to disregard errors during insertion of records so I would come up with only those good and error-free data?

e.g. I have to insert 1000 records. Then, the 998th record had encountered a data type error. Can I still insert the first 997 records, 999th and 1000th record?
Re: Disregard errors in inserting records [message #3049 is a reply to message #3044] Mon, 02 September 2002 06:34 Go to previous messageGo to next message
Mark
Messages: 284
Registered: July 1998
Senior Member
I'd be interested to here a good solution for this too. One method I use, although for different reasons, it to update data through MS Access. This achieves the results you want - when the update is done, a message appears telling you the number of records that could not be updated and the reasons why - but the 'vaild' records are committed.

I'll be keeping an eye on this post too...
Re: Disregard errors in inserting records [message #3053 is a reply to message #3044] Mon, 02 September 2002 13:02 Go to previous messageGo to next message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
If the rows are being inserted in a PL/SQL context, you can handle this easily using exceptions:

loop
  -- some loop or cursor providing the 1000 rows
  begin
    insert into ...;
  exception
    when others then
      null;
  end;
end loop;
Re: Disregard errors in inserting records [message #3083 is a reply to message #3044] Tue, 03 September 2002 18:08 Go to previous message
Manoj
Messages: 101
Registered: August 2000
Senior Member
i insert nearly a million records into databases everyday, and to prevent the trasaction form failing i uses a combination on C, unix shell and oracle scripts. the concept i used is to insert 1 line at a time and commit it as i go. using 'C' and shell scripting greately improves the speed. and i takes us less than 20 mins to insert 1 million recorrd each has a 43 column rows. (i don't know if this helps, but you can use the concept behind it , i think).
Previous Topic: Looking For "Elegant" Solution
Next Topic: Re: How to get the list of Oracle error messages?
Goto Forum:
  


Current Time: Fri Apr 19 07:11:42 CDT 2024