0

I am trying to insert some observations form a R dataframe (R_DATAFRAME) into a db2 dataset (DB2_TABLE) USING dbWriteTable function below

dbWriteTable(con1P, "DB2_TABLE", R_DATAFRAME, row.names=FALSE)

I am getting an -601 error, i did look up https://www-01.ibm.com/support/knowledgecenter/SSEPEK_10.0.0/com.ibm.db2z10.doc.codes/src/tpc/n601.dita I am unable to understand the description

Error in .local(conn, statement, ...) : 
  execute JDBC update query failed in dbSendUpdate 
(DB2 SQL Error: SQLCODE=-601, SQLSTATE=42710, SQLERRMC=DB2_TABLE;TABLE, DRIVER=4.15.82)

Any suggestions on this issue is much appreciated.

King Frazier
  • 243
  • 3
  • 14

1 Answers1

1

The SQL0601N error means that you're trying to create an object that already exists – in this case DB_TABLE.

I believe you need to add the append=TRUE option:

dbWriteTable(con1P, "DB2_TABLE", R_DATAFRAME, row.names=FALSE, append=TRUE)
Ian Bjorhovde
  • 10,916
  • 1
  • 28
  • 25