user image

Published in : 2022-03-01

SQLite3 Query: Unable to escape string with single quote characters while inserting into table.


I am using sqlite3 and created tables for the hybrid mobile applications. While executing insert query, it shows below error.

SQL error near line 16: near "s": syntax error

the line is,

INSERT INTO table_name (id, fullname) VALUES (98765, 'Robert O\'neils');

The issue is about escape character for a single quote. 

I also tried double escaping the single quote (using \\\' instead of \' ), but that ain't work either. 

What did I miss?


#sqlite #database


Rakshit Date : 2022-03-02

Best answers


Best answers


Mysql syntax: Working sqlfiddle, Replace single quote with single backward slash ("\") as given below.

INSERT INTO mytable values('98765','Robert O\'neils');


Sqlite syntax: Working sqlfiddle, Replace a single quote with another single quote.

INSERT INTO table_name (id, fullname) VALUES (98765, 'Robert O''neils');

Shilpa Date : 2022-03-02

Understood, the syntax is different in it! I see!

Leave a comment

Join us

Join our community and get the chance to solve your code issues & share your opinion with us

Sign up Now

Related posts

Is it possible to git commit files without adding a message or comments?
Publish date: 2022-03-02 | Comments: 2

Tag: General

Connecting jupyter notebook with Android studio
Publish date: 2022-03-05 | Comments: 1

Tag: General

Where can I find cheap Java and Mysql hosting server?
Publish date: 2022-05-03 | Comments: 3

Tag: General

Password authentication is temporarily disabled as part of a brownout.
Publish date: 2021-07-28 | Comments: 2

Tag: General

Convert Stored Procedure of Oracle to SQL Server
Publish date: 2022-03-02 | Comments: 1

Tag: General

Help with sliding an image from the top of a stack
Publish date: 2022-02-12 | Comments: 1

Tag: General

How to checkout to new created branch on bitbucket
Publish date: 2022-03-03 | Comments: 1

Tag: General