• Snehal Pathre 8
  • NEWBIE
  • 5 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Hello friends,

I am writing a batch and in the start method I am having this error "Unexpected token: OR in batch",
in my query. Can anyone please help me
Below is my piece of code. Thanks

The error is here  query += ' OR Statut__c = \'Caduque\'';
 
global class Batch_EnvoieMailContratPerdu implements Database.Batchable<sObject>{
    
    global Database.QueryLocator start(Database.BatchableContext BC){
         String query = null;
        
        query = 'SELECT Id';
        query += ', Reference_proposition_commerciale__c, Statut__c';
        query += ', ContratPerdue__c';
        query += ' FROM Contrat__c';
        query += ' WHERE ContratPerdue__c = false';
        query += ' AND Reference_proposition_commerciale__c != null';
        query += ' AND Statut__c = \'Résilié\'';
        query += ' OR Statut__c = \'Caduque\'';
       
         System.debug(query);
         return Database.getQueryLocator(query);
    }