SQLite quote() Function

The SQLite quote() function takes arguments and return them as SQL literals. The result of quote() is suitable for inclusion in an SQL statement.

For string arguments, the quote() function will surround the string with single quotes and escape single quotes within the string.

For BLOB parameters, the quote() function encodes it as a hexadecimal representation.


Here is the syntax of the SQLite quote() function:




Required. It can be a string or BLOB.

Return value

The SQLite quote() function returns a string that is the result of using single quotes around the parameter.


The following statement shows the basic usage of the SQLite quote() function.

SELECT 'I''m good', quote('I''m good');
'I''m good'  quote('I''m good')
-----------  ------------------
I'm good     'I''m good'

For a parameter of type BLOB, the quote() function encodes it as a hexadecimal representation:

SELECT quote(cast('HELLO' AS BLOB));
quote(cast('HELLO' AS blob))