Code
Apex Class:
global class DeleteBatch implements Database.Batchable<Sobject>{
global final String query;
global Database.QueryLocator start(Database.BatchableContext bc) {
return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext bc, List<Sobject> scope) {
Database.delete(scope,false);
Database.emptyRecyclebin(scope);
}
global void finish(Database.BatchableContext bc) {
}
}
Apex Code (Execution):
DeleteBatch objA = new DeleteBatch();
objA.query = 'SELECT Id FROM Account';
Database.executeBatch(objA,100);
Video
Video does not exists.