+ Start a Discussion
giri rockzzzzgiri rockzzzz 

Prblem with date comparison in dynamic soql....plz help

Compile Error: unexpected token: 'billStart' in last line ....can anyone help me ????



 public Date billStart;

  public Billing_Period__c inNewDate1;

  billStart = [Select Billing_Date__c from Billing_Period__c Where Id=:bl LIMIT 1].Billing_Date__c;


  billStart1 = billStart.addMonths(1);
        billStart2 = billStart.addMonths(2);
        billStart3 = billStart.addMonths(3);
        billStart4 = billStart.addMonths(4);
        billStart5 = billStart.addMonths(5);

 inNewDate1=[select Id from Billing_period__c where Billing_Date__c=billStart];



Imran MohammedImran Mohammed

You are missing colon(:) in the query.

inNewDate1=[select Id from Billing_period__c where Billing_Date__c = :billStart];


I would like to get your attention to the first query you have. The way you have the query to get Billing_Date__c may end you with null pointer exception.