Declaration
quote(str)
Description
Quoting a string to produce a result can be used to correctly escape data values in SQL statements.
In general, the returned string will be enclosed in single quotes (') at both ends.
Each backslash (\), single quotation mark ('), ASCII-encoded NUL value, and Control+Z is preceded by another backslash (\).
If the parameter is NULL, the return value is the string 'NULL' without single quotes.
Examples
obclient> SELECT QUOTE('Don\'t!');
+------------------+
| QUOTE('Don\'t!') |
+------------------+
| 'Don\'t!' |
+------------------+
1 row in set
obclient> SELECT QUOTE(NULL);
+-------------+
| QUOTE(NULL) |
+-------------+
| NULL |
+-------------+
1 row in set
obclient> SELECT LENGTH(QUOTE(NULL));
+---------------------+
| LENGth(QUOTE(NULL)) |
+---------------------+
| 4 |
+---------------------+
1 row in set