You need to sign in to do that
Don't have an account?
Siddharth
Do we have Query More functionality in APEX?
All,
Can we have querymore in APEX. I have around 1200 records which needs to be displayed at one go and I as read there is a limitation for 1000 records in APEX queries. So is there anything of QueryMore sort in APEX, or if not is it possible to achieve this.
Thanks
Siddharth
Account[] accts = [SELECT id FROM account];
The SOQL query for loop might look like this:
// Use this format if you are not executing DML statements
// within the for loop
for (Account a : [SELECT id, name FROM account
WHERE name LIKE 'Acme']) {
// Your code without DML statements here
}
Or this:
// Use this format for efficiency if you are executing DML statements
// within the for loop
for (List<Account> accts : [SELECT id, name FROM account
WHERE name LIKE 'Acme']) {
// Your code here
update accts;
}
Apex will invoke the queryMore feature behind the scenes in these scenarios.
I tried the line of code you provided and it worked well till 10000 records. If the number of records are more than 10000, it shows an error. Just wanted to know your view on this. Is there a workwround on this also??
Thanks in advance!!
[GM]
- R
setting the limit to 10000, makes the query work fine. I think this is the governer limit issue, if yes, can you please suggest the perfect way to resolve it or is it just putting some condition in the query which would narrow down the results.
Please advise.
Thanks,
[GM]
Hi Ron,
I am facing the same problem. There are over 40,000 contacts in the production instacne. I want to show those in my visual force page with some filter criteria. But there are atmost 10,000 query rows. If I put a limit 10,000 then it works fine. But if i try to get all the records a salesforce exception comes. Is there any method like queryMore so that i can get all the records.