Ask Your Question
0

syntax error if >1 SET in executeUpdate() [closed]

asked 2018-03-12 09:09:51 +0200

jeanDB gravatar image

updated 2020-07-27 20:12:31 +0200

Alex Kemp gravatar image

Hello. I am using SQLite via ODBC in Calc/Basic. I am trying to update database records with com.sun.star.sdbc. I can update one field only in a single 'executeUpdate' statement, more than one SET=xxx creates a syntax error and I can't see why. Can anyone advise please?

THIS WORKS:

stmt.executeUpdate("UPDATE statements_ca SET notes = 'uk' WHERE id=2")

THIS WORKS:

stmt.executeUpdate("UPDATE statements_ca SET nominal = 160 WHERE id=2")

But putting both SETs in one statement FAILS:

stmt.executeUpdate("UPDATE statements_ca SET notes = 'uk', SET nominal = 160 WHERE id= 2")

WITH THIS ERROR MESSAGE:

Error 1: An exception occurred Type: com.sun.star.sdbc.SQLException Message: near "SET": syntax error (1). (line : 16

Thanks

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2020-07-27 20:12:46.807827

1 Answer

Sort by » oldest newest most voted
0

answered 2018-03-12 09:20:17 +0200

jeanDB gravatar image

Sussed it. Only a single 'SET' required for all field values, not a 'SET' for each field.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-03-12 09:09:51 +0200

Seen: 99 times

Last updated: Mar 12 '18