Apex offers two ways to perform DML operations
1.Using DML statements
2.Database class methods
Difference between the two options that by using the Database class method.
You can specify whether or not to allow for partial record processing if errors are encountered.
you can do so by passing an additional second Boolean parameters.
if you specify FALSE for this parameter and if a record fails,the remainder of DML
operations can still succeed.
ex : Database.insert(accList,false);
False : partial processing allowed
True : partial processing not allowed
By default this optional parameter is true,which means that if at least one sObject can't be processed,all remaining sObjects won't and an exception will be thrown for the record that causes a failure.
No comments:
Post a Comment