You need to sign in to do that
Don't have an account?

Batch Apex : Too many DML rows: 10001 error
Hi Guys,
I have two objects Target List and Selling Area. Also have Target List Member object as junction of both. User can create target list and add selling area based on some search criteria. I am storing that SOQL in query field of Target List. Overnight batch to run through all target list get the query and iterate over query result and insert Target List Member records. But Batch class gives me Too Many DML rows error while insertion.
I am testing this with 4 target lists Each of them have separate query. These quries return 2764 records of selling area. Means 2764*4 target list members. Now requirement is one target list can have up to 50K-80K selling area, so setting scope to 1 won't solve my problem. Any suggestion or workaround?
Thanks,
Ankur
Are you inserting the records inside of your finish() method? That sounds like your problem: the finish() method has the same govenor limits as a single batch. Move the insert statements inside of the execute() method and it will insert batches of 200 at a time as the batches run, rather than saving them all for the end.
Nope. My insert statement is in execute method. I am inserting records in juction object and my batch query is on Target List.
Hi Ankur,
Do you find a work around yet? I am facing a similar issue and looking for any ideas.
Thanks,
Hi,
I am also facing same problem. Are got any solution for this. Please help me out.
Thanks,
Lakshmi