SALESFORCE BATCH CLASS GENERATING RESULTS AS CSV
Batch Apex: Let’s say you’re running a batch job with 20000 records, salesforce divides this batch into 100 transactions of 200 records each automatically. (Default batch size is 200 records). Let’s say we’ve 1000 erroneous records across those 100 transactions and we don’t know which transactions had errors. How do you maintain the state between these transactions? Database.Stateful allows to maintain state between transactions of a batch job. When using Database.Stateful, only instance member variables retain their values between transactions. Static member variables don’t and are reset between transactions.
To start on batch class basics: Batch Apex
AccountUpdateBatch.cls
To run the batch job..