[SalesForce] How to escape comma in SOQL

UPDATE:

SELECT Id, Name, Signature FROM User WHERE Signature = 'This is a test, 
this is a another test, 
this is a last test'

the above query returns the data only after I have split that in lines

Any explanation? I do not see any HTML code in the field

END UPDATE

I'm trying to write simple SOQL query that has comma in it.

SELECT Id, Name, Signature FROM User WHERE Signature = 'This is a
test, this is a another test, this is a last test'

If i run the above SOQL I do not get any result and I even tried with LIKE

SELECT Id, Name, Signature FROM User WHERE Signature LIKE 'This is a
test, this is a another test, this is a last test%'

Is there a way escape the comma?

Best Answer

The only characters you need to escape are listed in Quoted String Escape Sequences, which are \r, \n, \t, \b, \f, \', \", \\, \_, and \%. Commas do not need to be escaped. The most typical cause for a query not to return values is duplicated spaces (e.g. This is a test instead of This is a test). Try querying the record and checking out what's actually in the field. Also, there might be HTML in the field, which you would also need to account for.

Related Topic