You need to sign in to do that
Don't have an account?
venkyyy
In what scenarios the following error will come??
Hi Experts,
In what scenarios this ( "List has no rows for assignment to SObject" ) error will come ??
Please give me explenation,,
Thanks in advance.
In what scenarios this ( "List has no rows for assignment to SObject" ) error will come ??
Please give me explenation,,
Thanks in advance.
Take example like
=>you need to update accounts names to 'Venky' from who is already having account names as 'Ram'
for this
1) using SOQL ,get all the accounts having names Ram in entire Org.
2)Using For loop ,update the above list
List<Account>acclist=[Select Name from Account where Name like '%Ram%' ];
for(Account a:acclist){
a.Name='Venki';
}
update acclist;
The error "List has no rows for assignment to SObject" will occur in the case of no record existing having name 'RAM'.
i.e,acclist is null,but u are trying to update Null List.