I am getting the above error for :
for(String objName : objAPINames){
for(sObject s : Database.Query('Select Id from ' + objName + 'where CreatedDate <= ' + reqDate)){
recordIds.add((Id)s.Id);
}
}
Can anyone help with this
Your query should be like this.
Database.Query('Select Id from ' + objName + 'where CreatedDate <=: reqDate')