For some reasons I will not be able to publish the query.
Then it will be very difficult for anyone to help. Also, for what it is worth, the code to a query can be published - just change the "secret" values to something else. . . Keeping the code consistent.
But just wanted to know if this error is because of syntax error while preparing the query?
Copy/paste the query into spufi or a batch job and see if it works.