You need to sign in to do that
Don't have an account?
groundwired
aggregate query with batch apex
Are the new aggregate queries supposed to work with batch apex? I didn't find anything that says it is unsupported, but I sent a "group by rollup" query to a batch class, and got this error:
System.Exception: Aggregate query does not support queryMore(), use LIMIT to restrict the results to a single batch
Any ideas?
The LIMIT clause limits the number of final output rows. It doesn't limit the rows that the aggregation is based on.
If you are right, jesperfj, then there is no way to issue a group by query without risking an unhandled exception by hitting limits. According to a new note in the documentation, the governor limits are based on the number of rows you aggregate, not the rows returned - but how would you know ahead of time how many you are going to affect? This is a problem that Salesforce needs to address soon.
Speaking of problems, has anyone else been hitting "Internal Server Error" bugs in Salesforce when running aggregate queries (GROUP BY ROLLUP, GROUP BY CUBE)? I have built an application that runs fine one day, and then causes these unhandled exceptions the next - seems to be completely random. Have logged a case (03416031) but would be interested to hear if anyone has seen this.
I get a salesforce internal error also. Same situation when i use the aggregate function in SOQL like Max, Having and group by) and its random, I have this SOQL running in a batch that is schedule to run every night. The errors are random and i can't find a pattern. If anyone has ideas please share . Sample error below
Salesforce System Error: 226624809-1628 (1928603964) (1928603964)
Thanks
I've run into the "Aggregate query does not support queryMore()" error also. Very frustrating. I'm running this in a full copy sandbox and I invoked the batch using execute anonymous.