function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
shaanRocksshaanRocks 

retrieving records more than 10000 from an soql query

Hi,

 

Is there any way to retrieve records more than 10000(ex: 30000) from an object in apex.

Can we make use of @future to retriev ethe records if yes whats the approach?

 

To be more clear i ahve an example:

 

List<Contact> ListCntct = [select name from contact where accountID = Account.ID];

 

Thanks in Advance

 

Shaan

 

 

sfdcfoxsfdcfox

Normal Apex Code is limited to 10,000 rows. You can use a StandardSetController to query a large number of records through a Visualforce component, or use Batch Apex to process a large number of records in an asynchronous process. What exactly are you attempting to do?

Pradeep_NavatarPradeep_Navatar

Go through the sample code given below to retrieve more than 10000 records :

 

           List<List<Account>> ListListAcc = New List<List<Account>>();

           List<Account> ListAcc;

            for(Integer i=0; i<5; i++)

            {

                ListAcc = [Select id, name From Account limit 10000];

                ListListAcc.add(ListAcc);

            }

            for(List<Account> ListA : ListListAcc){

                for(Account ac : ListA){  // Display account records} }