Make SOQL Case-Insensitive?

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 insensitive. For example, if net_Id__pc = 'jOeDoe' and pFederationID = 'joedoe' then they should be considered equal. How can this be done?

Answer

It’s case-insensitive by default.

From the Force.com SOQL and SOSL Reference on WHERE conditionExpression:

comparisonOperator Case-insensitive operators that compare values.

Operator =
Name Equals
Description Expression is true if the value in the specified fieldName equals the specified value in the expression. String comparisons using the equals operator are case-sensitive for unique case-sensitive fields and case-insensitive for all other fields.

Attribution
Source : Link , Question Author : Jose Cabrera Zuniga , Answer Author : Community

Leave a Comment