【发布时间】:2017-03-31 09:28:19
【问题描述】:
我的目标是在数据库中创建一个表,然后用数据填充它。这是我的代码:
library(ROracle)
# ... "con" is the connection string, created in an earlier stage!
# 1 create example
testdata <- data.frame(A = c(1,2,3), B = c(4,5,6))
# 2 create-statement
createTable <- paste0("CREATE TABLE TestTable(", paste(paste(colnames(testdata), c("integer", "integer")), collapse = ","), ")")
# 3 send and execute query
dbGetQuery(con, createTable)
# 4 write example data
dbWriteTable(con, "TestTable", testdata, row.names = TRUE, append = TRUE)
我已经成功了几次。该表已创建并填充。
现在第 4 步不再起作用,但 R 在执行 dbWriteTable 后返回 TRUE。但是桌子还是空的。
我知道这是一个模糊的问题,但有人知道这里可能出了什么问题吗?
【问题讨论】:
-
我不认为这是一个模糊的问题。