This content has been marked as final. Show 4 replies
948415 wrote:Drop your Looping. Do it in direct SQL. If not use BULK COLLECT. And to cache the error data use DML Error Logging
Hi, need an help
WHILE v_rec IS NOT NULL LOOP
-- FOR rec_inv IN t_inv.first..t_inv.last LOOP
If t_inv(v_rec)=16249857 then
Exception -- Added exception to handle error for Large Invoice ID which has more than 32760 characters
when others then
DBMS_OUTPUT.PUT_LINE('Error occured for Invoice Id: ' || t_inv(v_rec));
v_rec := t_inv.NEXT(v_rec);
v_t_cnt := v_t_cnt + 1;
I have writen this block, this code will try to catch teh exception once it gets any large inpvice id with greter than 32760 characters and continue with Inserting other invoice ID which are stored in the t_inv pl/sql tables.
But this is inserting duplicate REcords, i can see the t_inv.count is having the appropriate number of records like 50 but everytime when i run its inserted more than no of t_inv.count.
[url http://docs.oracle.com/cd/E11882_01/server.112/e25494/tables004.htm#ADMIN10261]Avoiding Bulk INSERT Failures with DML Error Logging
What awful code. How will anyone know what the error was that occurred?
when others then DBMS_OUTPUT.PUT_LINE('Error occured for Invoice Id: ' || t_inv(v_rec));
If you can't handle the error, done capture it, just let it raise.
Here's a sort of summary regarding DML Error Logging, it gives you a quick overview:
and here's a more detailed 'rantexplanation' regarding your WHEN OTHERS ;) :
the above code is correct.. i forgotremove the rollback statement in the insert_use_case proc, so everytime whenever i was inserting it was doign rollback and again inserting.