0

I am trying to update a value in an Oracle database connected using RJDBC (the connectionis fine as I can query the database from within R). I tried the following (and many variants of it):

dbSendUpdate(db_iot, "UPDATE IOT_DATA SET IOTFILE = (?)  WHERE VARIABLE = (?);", "1_prod_vorl_0.Rmd", 'wss')

In Oracle Developer I can run the query like this without any problems:

UPDATE IOT_DATA SET IOTFILE = '1_prod_vorl_0.Rmd' WHERE VARIABLE = 'wss';

Any help would be appreciated.

Cheers

Renger

arnyeinstein
  • 669
  • 1
  • 5
  • 14
  • Try removing parentheses in parameter placeholders. And also remove semicolon. – Art Bauer Aug 31 '22 at 16:39
  • library(RJDBC) dbSendUpdate(db_iot, "UPDATE IOT_DATA SET IOTFILE = ? WHERE VARIABLE = ?", "1_prod_vorl_0.Rmd", 'wss') Didn't work. R is hanging and nothing seems to happen. I have to kill RStudio and restart. If I add the semicolon, I get the following message Error in .local(conn, statement, ...) : execute JDBC update query failed in dbSendUpdate (ORA-00933: SQL-Befehl wurde nicht korrekt beendet – arnyeinstein Sep 01 '22 at 13:48
  • Try executing the statement without using placeholders: `dbSendUpdate(db_iot, "UPDATE IOT_DATA SET IOTFILE = '1_prod_vorl_0.Rmd' WHERE VARIABLE = 'wss'")` And you could try using `dbSendStatement` instead – Art Bauer Sep 01 '22 at 17:44
  • dbSendUpdate(db_iot, "UPDATE IOT_DATA SET IOTFILE=? WHERE VARIABLE=?", "11_prod_vorl_0.Rmd", 'wss') worked. Thanks! – arnyeinstein Sep 01 '22 at 17:55

0 Answers0