function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sarma DuvvuriSarma Duvvuri 

Error while running the batch class

Hi,

I am not able to run the batch for the below quesry.

i am getting below error messages after modifications also. kindly help.
1. First error: Only variable references are allowed in dynamic SOQL/SOSL.
2. First error: unexpected token: '='
3. IF i mention IN instead of = i got error message like First error: unexpected token: 'IN'
4. First error: expecting a colon, found 'NULLStatus__c'
5.First error: Too many query rows: 50001 (Main Error)

I want to  get all the ACTIVE status customers from orders.

Code:
global with sharing class Batch_ProductVolumeTarget_Stats implements Database.Batchable<sObject>
{
  public class X_Exception extends Exception{}

  global Database.QueryLocator start(Database.BatchableContext BC)
  {
    string  strQuery =
      ' select  Id'  +
      ' from     Order__c ' +
      ' where    Customer__C= NULL';
      
    return Database.getQueryLocator(strQuery);
  }

Regards,
Sarma
v varaprasadv varaprasad
Hi Sharma,

Please check once following code, in your query spaces or not there.
 
string  strQuery =' select  Id'+
      ' from Order__c'+
      ' where Customer__C = NULL';      
  
list<contact> lstcons =database.query(strQuery);
system.debug('==lstcons=='+lstcons);

return Database.getQueryLocator(strQuery);

Hope this helps you!

Thanks
Varaprasad
For Support: varaprasad4sfdc@gmail.com
v varaprasadv varaprasad
string  strQuery =' select  Id'+
      ' from Order__c'+
      ' where Customer__C = NULL';      
  


return Database.getQueryLocator(strQuery);

 
Sarma DuvvuriSarma Duvvuri
Hi Prasad,

How to get Active Satus records?

Sarma