11

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?

1 Answer 1

23

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.

8
  • 2
    so, if a non case sensitive field is compared against a case sensitive one, what could happen?
    – Jose
    Sep 14, 2016 at 14:42
  • 3
    The field configuration is irrelevant. All SOQL comparisons are case-insensitive. Full stop.
    – Adrian Larson
    Sep 14, 2016 at 14:43
  • 1
    Looks like comparison against __mdt (custom metadata record) fields are case-sensitive.
    – wesaw
    Oct 17, 2017 at 14:10
  • 1
    @wesaw That is a bug. The dev team is currently working on a fix.
    – Adrian Larson
    Oct 17, 2017 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, 2017 at 15:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .