Syntax
quote(str)
Purpose
You can call this function to quote a string to generate a result that can be used as a properly escaped value in an SQL statement.
Generally, the returned string is generated by enclosing the original string in a pair of single quotation marks (').
A backslash (\) is added before each backslash (\), single quotation mark ('), ASCII NUL, and Control+Z.
If the argument is NULL, the return value is also NULL, without single quotation marks.
Examples
obclient> SELECT QUOTE('Don\'t!');
+------------------+
QUOTE('Don\'t!')
+------------------+
'Don\'t!'
+------------------+
1 row in set (0.00 sec)
obclient> SELECT QUOTE(NULL);
+-------------+
QUOTE(NULL)
+-------------+
NULL
+-------------+
1 row in set (0.00 sec)
obclient> SELECT LENGTH(QUOTE(NULL));
+---------------------+
LENGth(QUOTE(NULL))
+---------------------+
4
+---------------------+
1 row in set (0.00 sec)