I have query in batch apex to delete records from Salesforce. The query is:
global date ext_date=System.today().addDays(-7);
string query='select id,name,Campaign__c,Contact__c,Date_Bounced__c,Date_Time_Opened__c,Date_Time_Sent__c,Date_Unsubscribed__c,From_Address__c,From_Name__c,Lead__c,Number_of_Total_Clicks__c,Number_of_Unique_Clicks__c,Opened__c,Report_Name__c,Subject_Line__c from xtma_Individual_Email_Result__c where createddate<=:ext_date AND Date_Time_Opened__c=null limit 200000 ';
but its failing to delete the records giving this error:-
First error: SQLException [java.sql.SQLException: ORA-01013: user requested cancel of current operation : select /*ApexBatch.Class.Del_Ind_Email_Results.start: line 21*/ * from (select "Id", "Name", "Campaign_c", "Contact_c", "Date_Bounced__c", "Date...
I raised a case to Salesforce but they are saying it is non-selective and to make it selective. How do I make it selective? Date_Time_Opened__c (Date data type)