6

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?

12

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.

  • 2
    so, if a non case sensitive field is compared against a case sensitive one, what could happen? – Jose Cabrera Zuniga Sep 14 '16 at 14:42
  • 1
    The field configuration is irrelevant. All SOQL comparisons are case-insensitive. Full stop. – Adrian Larson Sep 14 '16 at 14:43
  • 1
    Looks like comparison against __mdt (custom metadata record) fields are case-sensitive. – wesaw Oct 17 '17 at 14:10
  • 1
    @wesaw That is a bug. The dev team is currently working on a fix. – Adrian Larson Oct 17 '17 at 14:22
  • yep, but (WHERE Profile__c LIKE 'System Admin') is still case-insensitive with a bit of performance implication (as a temporary workaround) – wesaw Oct 17 '17 at 15:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.