LIKE operator in SOQL against set of strings

LIKE operator in SOQL against set of strings

LIKE operator in SOQL can be used against set of strings. Use : to check against Set < String > variable. Check the following code for reference.
 
Sample Code:

Set < String > filterOptions = new Set < String > {‘Test%’, ‘Sample%’, ‘%Temp%’}
List < Accont > listAccts = [ SELECT Id FROM Account WHERE Name LIKE : filterOptions ];

Leave a Reply