Apex SOQL For Loop - Apex

What is Apex SOQL For Loop?

When there is no need to create the List and directly iterate over set of records of SOQL query, this SOQL For Loop is used. SOQL For Loop returns list of records and fields as given in the query.



The variable_list or variable should always be of same type as the records returned by the Query. In our example, it is of same type as APEX_Invoice_c.

Flow Diagram

Apex SOQL For Loop

For Loop example using SOQL for loop is shown by the following example:

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Apex Topics