In MaxCompute SQL, the backslash character (
\) is an escape character that invokes an alternative representation on the following
characters in a character sequence or indicates a literal interpretation of these
If the backslash character (\) in a string constant is followed by three valid octal digits in the range from 001 to 177, the combination of the backslash and the three digits is interpreted into an ASCII character.
|Escape sequence||Represented character|
|\'||Single quotation mark|
|\"||Double quotation mark|
|\0 or \00||Terminator|
- Use an escape sequence to represent a string constant.
In MaxCompute SQL, you can represent a string constant by using single quotation marks or double quotation marks. A string constant that contains a double quotation mark can be enclosed in a pair of single quotation marks. A string constant that contains a single quotation mark can be enclosed in a pair of double quotation marks. You can also use the backslash (\) as an escape character to represent a string constant. The following example shows two ways to represent a string constant:
"I'm a happy manong." 'I\'m a happy manong.'
- Use an escape sequence to represent a special character. For example, run the following
The preceding command returns 3, which indicates that the string contains three characters and that
select length('a\tb') from dual;
\tis treated as one character.
The preceding command returns aab, 3, which indicates that
select 'a\ab',length('a\ab') from dual;
\ais treated as letter a.