Please mark this as solved if the information helps so that it gets removed from the unanswered queue which results in helping others who are encountering a similar issue.
=: symbol is used inside the SOQL query to comapre a condition with an external object/variable that already define. Here is the example :
public void accRecords(){
String userName = 'Amit';
// List get all records with name is Amit
List<Account> accountRecords = [SELECT name,BillingCity,Phone FROM account where name =: userName ];
if(accountRecords.size() > 0){
System.debug('Records are here');
}
else {
System.debug('No Record Found');
}
}
HI , ":" :- symbol represents bind variable in query "=" :- if we give eqval with name in single quotation. we dont need ":" this variable List<Contact> ListOfName = [SELECT FirstName, LastName FROM Contact WHERE FirstName = 'sree'];
"=:" :- If we mention the name in string . we have to bind it in query . we need ": " this symbol. String name = 'sree'; List<Contact> ListOfName = [SELECT FirstName, LastName FROM Contact WHERE FirstName = : name];
i hope it helps you Let me inform if it helps you Thanks
Please check with below post from the forums community which has clear explanation.
- https://developer.salesforce.com/forums/?id=9060G000000XfpaQAC
- https://en.wikipedia.org/wiki/List_of_mathematical_symbols
Hope this helps.Please mark this as solved if the information helps so that it gets removed from the unanswered queue which results in helping others who are encountering a similar issue.
Best Regards,
Nagendra.
=: symbol is used inside the SOQL query to comapre a condition with an external object/variable that already define.
Here is the example : Let me know if this helps you.
Regards,
Akshay
use ":" bind variable for access variable in query like
String MyName = 'vasu';
List<Contact> ListOfName = [SELECT FirstName, LastName FROM Contact WHERE FirstName = : MyName];
use "=" operator is simple Equal operator in query like-:
List<Contact> ListOfName = [SELECT FirstName, LastName FROM Contact WHERE FirstName = 'Patil'];
[give contact list where firstName = (equal) Patil]
Thanks !
":" :- symbol represents bind variable in query
"=" :- if we give eqval with name in single quotation. we dont need ":" this variable
List<Contact> ListOfName = [SELECT FirstName, LastName FROM Contact WHERE FirstName = 'sree'];
"=:" :- If we mention the name in string . we have to bind it in query . we need ": " this symbol.
String name = 'sree';
List<Contact> ListOfName = [SELECT FirstName, LastName FROM Contact WHERE FirstName = : name];
i hope it helps you
Let me inform if it helps you
Thanks