You need to sign in to do that
Don't have an account?
ajay ambati
exceptions
how to avoid more dml and soql queries operations in loop? give me exact answer for this?
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
https://developer.salesforce.com/page/Apex_Code_Best_Practices
Placing the SOQL or DML statements with in a loop hits the governor limits as it iterates over the size of the list(usually collection).
An individual Apex request gets a maximum of 100 SOQL queries before exceeding that governor limit. So if any operation is invoked by a batch of more than 100 Account records, the governor limit will throw a runtime exception.
Usually, there is a limit of 150 DML operations per request, a governor limit will be exceeded after the 150th contact is updated.
Here is the optimal way to 'bulkify' the code to efficiently query the contacts in a single query and only perform a single update DML operation.
Please follow the links for more details:
https://developer.salesforce.com/page/Apex_Code_Best_Practices
https://developer.salesforce.com/blogs/developer-relations/2015/01/apex-best-practices-15-apex-commandments.html
https://developer.salesforce.com/page/Best_Practice:_Use_of_the_Limits_Apex_Methods_to_avoid_Hitting_Governor_Limits
Hope this helps you!
Best Regards,
Deepthi