Newer Version Available

This content describes an older version of this product. View Latest

Quoted String Escape Sequences

You can use the following escape sequences with SOQL:

Sequence Meaning
\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 ( % )

If you use a backslash character in any other context, an error occurs.

Escaped Character Examples

SELECT Id FROM Account WHERE Name LIKE 'Ter%'
Select all accounts whose name begins with the three character sequence 'Ter'.
SELECT Id FROM Account WHERE Name LIKE 'Ter\%'
Select all accounts whose name exactly matches the four character sequence 'Ter%'.
SELECT Id FROM Account WHERE Name LIKE 'Ter\%%'
Select all accounts whose name begins with the four character sequence 'Ter%'