SOQL defines several escape sequences that are valid in queries so that you can include special characters in your queries. You can escape new lines, carriage returns, tabs, quotes, and more. The escape character for SOQL is the backslash (\) character.
You can use the following escape sequences with SOQL:
|
|
|
|
\n or \N |
New line |
|
\r or \R |
Carriage return |
|
\t or \T |
Tab |
|
\b or \B |
Bell |
|
\f or \F |
Form feed |
|
\" |
One double-quote character |
|
\' |
One single-quote character |
|
\\ |
Backslash |
|
LIKE expression only: \_ |
Matches a single underscore character ( _ ) |
|
LIKE expression only:\% |
Matches a single percent sign character ( % ) |
|
\uXXXX |
A Unicode character with XXXX as the code (for example, \u00e9 represents the é
character) |
An escape sequence character is a character that invokes an alternative interpretation of the subsequent characters in a character sequence.
SOQL syntax
//to query string name = 'joe's' so it wont support if we put directly like this
Select id, name from Account Where Name = 'Joe\'s'