Delete Statement

The delete DML operation deletes one or more existing sObject records, such as individual accounts or contacts, from your organization’s data. delete is analogous to the delete() statement in the SOAP API.


delete sObject | ID

delete sObject[] | ID[]


The following example deletes all accounts that are named 'DotCom':

Account[] doomedAccts = [SELECT Id, Name FROM Account 
                         WHERE Name = 'DotCom']; 
try {
    delete doomedAccts;
} catch (DmlException e) {
    // Process exception here
For more information on processing DmlExceptions, see Bulk DML Exception Handling.
© Copyright 2000–2014, inc. All rights reserved.
Various trademarks held by their respective owners.