So lets take an example if you want to query account records and then you want to update the same then following is code you shoudl be using to achiev this.
In your class or trigger whereever you want to do thuis operation.
list<Account> lastAccToUpdate = new list<Account>();
for(Account objAccount : [select id, Name from Account limit 10])
{
objAccount .name = 'TestName';
lastAccToUpdate.add(objAccount );
}
update lastAccToUpdate;
in above code I am getting 10 account records from query and then I am updating tehir name.
Please try and let me knwo if you have any other question or doubt.
So lets take an example if you want to query account records and then you want to update the same then following is code you shoudl be using to achiev this.
In your class or trigger whereever you want to do thuis operation.
in above code I am getting 10 account records from query and then I am updating tehir name.
Please try and let me knwo if you have any other question or doubt.
Thanks