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
ChinnoduChinnodu 

How to we can write multiple batch sizes in single batch apex.

H i All,

How to we can write multiple batch sizes (indidual size )in single batch apex.class

Can you pls explian me with one example.


Regards,
Viswa.
pconpcon
What are you trying to accomplish with this?  Are you talking about providing something more than the scope size to your executeBatch call?
ChinnoduChinnodu
HI Pcon,

Actually my requirement is , for example we have 10000 records, these ten thound records can be insrted 3000,3000,3000 at atime in single batch execution , how to we can achive this , can you pls give me one example on this....


Regards,
Viswa.
pconpcon
The largest batch you can have is 2000 records [1].  So you would have to have it run in 5 batches.  Have you read over the batch apex documentation [2].  Asking for an example on this is going to net you the same code that is on the documentation.  If you have any specific qustions, I'll be more than glad to help you.

[1] https://help.salesforce.com/apex/HTViewSolution?id=000176644&language=en_US (https://help.salesforce.com/apex/HTViewSolution?id=000176644&language=en_US)
[2] https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_batch.htm
ChinnoduChinnodu
HI Pcon,

Thanks for your responce.., this kind of things i know , but i am facing how to i can write up to 3 queued bach jobs as a functionlaity . i want example code in single batch apex calss ,  pls try to understand my problem.
pconpcon
I do not understand your problem or what you are trying to do