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

Create a free account to save this page, take notes and track your progress. Sign in

Syntax

quote(X)

Parameters

ParameterDescription
X Any value.

Return value

Text.

Examples

SQL literalsTry it yourself
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
Generate SQL statementsTry it yourself
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);

Was this page helpful?