Skip to main content

QUOTE

Returns the text of a value as a SQL literal: strings are enclosed in single quotes with embedded single quotes doubled, numbers are returned as they are, and NULL is returned as the word NULL.

See also:
[SELECT] [JSON_QUOTE]


Syntax​

SELECT QUOTE(value) FROM <multipartIdentifier>;

Arguments​

value
Any value.

Return Value(s)​

Returns a string.


Examples​

Quote values as SQL literals​

The following query quotes a string containing an apostrophe, a number and NULL:

SELECT QUOTE('it''s') AS s, QUOTE(42) AS n, QUOTE(NULL) AS z;
|---------|----|------|
| s | n | z |
|---------|----|------|
| 'it''s' | 42 | NULL |
|---------|----|------|

For more information, see https://www.sqlite.org/lang_corefunc.html#quote