You need to sign in to do that
Don't have an account?
Shephali Swarnkar
help to understand the following code execution
if I have 2430 opportunity. for how many times each LOC will execute and why? and how it will solve the Heap size and DML issues. 1. for (List<Opportunity> Opps : [SELECT Id FROM Oportunity]) { 2. for (Contact opp : Opps){ 3. // Modify opp 4. } 5. Database.update(Opps, false); 6. }
1. Inside the loop DML should be removed.
2. At line number two, you cannot iterate opps with Contact.
Code is incorrect.
Here in this code sample, line1 will run forr 1time and it will fetch all 2430 records. If there are 10,000 records or say even more then too line 1 will execute for 1 time. so in such case how it will handle the HeapSize limit?