user1315789
user1315789

Reputation: 3649

What is wrong with the syntax of this sqlite code?

My SQLite SQL code looks like this;

INSERT OR IGNORE INTO box_infos (symbol, name) 
VALUES( 'DXSS.SI', 'DXSS Group') 

UPDATE box_infos 
SET name = 'DXSS Group' 
WHERE symbol = 'DXSS.SI';       

However, I get

Syntax error near "UPDATE"

What is wrong with the code? I used the answer below as a guide. https://code.i-harness.com/en/q/377728

Upvotes: 0

Views: 47

Answers (1)

DinoCoderSaurus
DinoCoderSaurus

Reputation: 6520

"Chained" SQLite commands each need to be terminated by ';'. In this case, SQLite does not know where the INSERT ends and the UPDATE begins. All things being equal, this should work, as long as the INSERT query is terminated with ;.

Upvotes: 2

Related Questions