SQLite 3 reference · String Functions
SQLite QUOTE() Function
Return a value written as an SQL literal: text in single quotes with quotes doubled, BLOBs as X'..', NULL as NULL.
SQLite 3
Syntax
quote(X)
Parameters
| Parameter | Description |
|---|---|
X |
Any value. |
Return value
Text.
Examples
SELECT quote('It''s here') AS text_literal, quote(42) AS number, quote(NULL) AS null_value;
Output
text_literal | number | null_value 'It''s here' | 42 | NULL
SELECT 'INSERT INTO cities VALUES (' || quote(city) || ');' AS statement
FROM customers
WHERE customer_id IN (1, 7);
Output
statement
INSERT INTO cities VALUES ('London');
INSERT INTO cities VALUES (NULL);Related
FORMAT()· Build a string from a template with printf-style placeholders such as %s, %d, %.2f and %,d. printf() is the old name.TYPEOF()· Return the storage class of a value: 'null', 'integer', 'real', 'text' or 'blob'. Shows how SQLite stored it.- SQL String Functions · tutorial