+ Start a Discussion
Prashanth Kumar Singh Poorna SinghPrashanth Kumar Singh Poorna Singh 

Batch Apex Query Saving Error

Hello , 

I am trying to write a simple Batch Apex class with the query below but not able to save , As I am getting error. Can anyone please help me.

global class Batch_VolunteerStatus implements Database.Batchable<sObject> {
    
    public String query = ''; 
    
    global Database.QueryLocator start(Database.BatchableContext BC){
        query = 'SELECT Id,Last_Background_Check_Date__c,Last_Background_Check_Status__c,Background_Check_Valid1__c,Name,Volunteer_Status__c' +
                 'FROM Contact' + 
                 'WHERE Volunteer_Status__c != \'' + Do Not Pursue + '\'' +
                  'AND  Last_Background_Check_Status__c != \'' + Fail + '\'' + 
                  'AND Background_Check_Valid1__c = \'' + false + '\''; 
        

      return Database.getQueryLocator(query);
   }
   
   global void execute(Database.BatchableContext BC, List<Contact> DateexpiredContact)
    {
        
    }
    
    
    global void finish(Database.BatchableContext BC) 
    {
    }
   

}

Getting error as 
Compilation error: unexpected token: 'Do'    
Venkata Sravan Kumar BandariVenkata Sravan Kumar Bandari
check out the soql query there is "Do Not Pursue" spaces not accepted here.