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
Shashi SalesforceShashi Salesforce 

Case sensitive LIKE in SOQL

Hi,

 

Is there any way to make LIKE operator work in a case sensitive way in SOQL? Please help.

 

Thanks,

Shashi

Ankit AroraAnkit Arora

Hi Shashi,


The LIKE operator performs a case-insensitive match, unlike the case-sensitive matching in SQL. So if you want to get results according to the case sensitivity then you first have to fetch the records with LIKE operator in list and than addition check over the list to get case sensitive records.


Thanks

Ankit Arora

Blog | Facebook | Blog Page

gayatri sfdcgayatri sfdc
Hi Shashi,

As per requirement, you initially need to convert the values to the upper/lower case and then use that in the  Query.

Set<String> list_of_email_ids_lc = new Set<String>();

for(String emailId : list_of_email_ids){ list_of_email_ids_lc.add(emailId.toLowerCase()); } List<Custom_Object> objects = [SELECT Id, Custom_Email_Id from Custom_Object where Custom_Email_Id IN :list_of_email_ids_lc];