Skip to main content
Aniruddha Maiti (Huntington Bank) a posé une question dans #Apex
I am trying to understand the DML and Query Record Governor limits.

Code:

list<account> a = new list<account>();

    for(integer i=0;i<9999;i++)    {

        a.add(new account(Name =('ani '+(i*4).format()),AccountNumber=('anii'+(i*8).format())));    }

      database.insert(a); 

TRying this it throws-> QUery over 50,000 records..

If I try inserting 1000 records and take the insert(a) inside the loop, DML error limit 150. I can understand that but please help me understnad the query record error. I am on Developer free edition and have only 10 records in Account object.

 
1 réponse
  1. 15 nov. 2015, 23:30
    Are you querying any records in the same class, and looping in a similar manner?  Or perhaps you have a trigger on the Account object that kicks off a query?
0/9000