Skip to main content

global class OppCloseDateBatch implements Database.Batchable<sObject> {

    global String query = '';

    list<opportunity> OppList = [SELECT Id, CloseDate FROM Opportunity WHERE CloseDate=NEXT_N_DAYS:3];

    global Database.QueryLocator start(Database.BatchableContext bc)

    {

        query = 'SELECT Id, CloseDate FROM Opportunity WHERE CloseDate=NEXT_N_DAYS:3';

        system.debug('>>>>' + query);

        return Database.getQueryLocator(query);       

    }

   

    global void execute (Database.BatchableContext bc , list<opportunity> optyLst)

    {

      try{

for(Opportunity opp : optyLst)

        {

            date updated_Date= getOppRecords.getClosedDateMethod(opp.CloseDate);

       

            opp.CloseDate= updated_Date;

        }

update optyLst;

}

        catch(DmlException e) {

        System.debug('The following exception has occurred: ' + e.getMessage());

        } 

    }

     

    global void finish(Database.BatchableContext bc)

    {

        AsyncApexJob job = [SELECT Id, Status FROM AsyncApexJob WHERE Id = :bc.getJobId()];

System.debug('*****finish*****' + job.Status);

    }

}

 

ERROR:  Method does not exist or incorrect signature: void getQueryLocator(String) from the type database .

4 answers
0/9000