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
Jose ZunigaJose Zuniga 

Case sensitivity in SOQL QUERY

I have this query:

List<id> accounts1 = [SELECT Id, PersonContactId, PersonEmail, FirstName, LastName, net_Id__pc FROM Account
                             where net_Id__pc = pFederationID]

I need the constraint   net_Id__pc = pFederationID  to be case non sensitive. I mean, if net_Id__pc = 'jOeDoe'  and   pFederationID = 'joedoe' then they should be considered equal. How can this be done?
@Karanraj@Karanraj
Is net_Id__pc field is unique case-sensitive field? In general string comparisons using the equals operator are case-sensitive for unique case-sensitive fields and case-insensitive for all other fields. If the field net_Id__pc is case senstive then it will always check for the exact match. The one other option will be always store values in lower case in  the net_Id__pc field then in the code use string function to convert the case  pFederationID.tolowercase()
karthikeyan perumalkarthikeyan perumal
Hello Jose, 

Comparisons on strings are case-insensitive.
Please refer to:
https://www.salesforce.com/us/developer/docs/dbcom_soql_sosl/Content/sforce_api_calls_soql_select_comparisonoperators.htm

Thanks
Karthik