I dont think that there is any limit like 10,000 in single insert.
Now it depends on Heap memory size. Can you please provide documentation link if you find that there is limit of 10,000 records in single insert statement
Or just use multiple dml statements ?, if you're sure the amount of records / 10k won't ever reach the limit on dml statements you can make. But, you can verify so in apex.
update: wrong info. was confusing different limits.
list<Temp__c> tmpList = new list<Temp__c>();
for (Integer i=0; i<12000; i++)
{
Temp__c obj = new Temp__c();
obj.Name = String.valueOf(i);
tmpList.add(obj);
if (tmpList.size() >= 10000)
{
insert tmpList;
tmpList.clear();
}
}
if (tmpList.size() > 0) insert tmpList;
SFDC would be a crap platform if you couldn't insert more than 10K records. If you need to do more than 1MM records, this won't work, of course - then you have to use @future or batch.
May be you can use a combination of synchronous and asyncronous Apex to solve this problem . Use a List for inserting intial 10000 records and @future for remaining record.
There wont be much delay in that i believe and it happens seaminglessly.
Hi Deepu,
Just create the list of records you want to insert and using single DML statement you can insert it.
Example :
it allows only to create 10000 records not more than tht
I dont think that there is any limit like 10,000 in single insert.
Now it depends on Heap memory size. Can you please provide documentation link if you find that there is limit of 10,000 records in single insert statement
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_dml_insert.htm
i am unable process more than 10000 record it is throwing a dml error
I have also tried to replicate. You can only have 10000 DML operations so only option with you is "Batch Apex" or "Scheduled Job"
Or just use multiple dml statements ?, if you're sure the amount of records / 10k won't ever reach the limit on dml statements you can make. But, you can verify so in apex.
update: wrong info. was confusing different limits.
Even multiple DML will not work. In single request only 10000 DML operations are allowed.
So break it up:
SFDC would be a crap platform if you couldn't insert more than 10K records. If you need to do more than 1MM records, this won't work, of course - then you have to use @future or batch.
Good luck!
Even above solution will not work.. In Single transaction 10,000 is upper limit. You have to use Batch Apex in this case
May be you can use a combination of synchronous and asyncronous Apex to solve this problem . Use a List for inserting intial 10000 records and @future for remaining record.
There wont be much delay in that i believe and it happens seaminglessly.