Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ROracle dbWriteTable creating Oracle TIMESTAMP columns for R DATE columns

I'm trying to upload some data to my Oracle 11g database using the ROracle package (1.1-10) in 64bit R3.0.0 on Windows 7 64-bit.

The ROracle help for dbWriteTable states:

Date and POSIXct map to Oracle DATE ROracle - the ROracle package R - the R application POSIXct - the POSIXct class TIMESTAMP TIMESTAMP WITH TIME ZONE TIMESTAMP WITH LOCAL TIME ZONE

Yet when I run this R code...

df <- data.frame(a = as.Date(c("2012-01-01","2013-02-07")), b = c("one","two"))

drv <- dbDriver("Oracle")
myconn <- dbConnect(drv, "XXXXX", "XXXXX", "XXXXX")

dbWriteTable(myconn, "MY_TABLE", overwrite = TRUE)

It produces a table in Oracle like so...

enter image description here

Anyone know what gives? Am I reading the help docs wrong?

I've written a function that converts those to DATE in Oracle using the alter table syntax, but I'd much rather not have to...

like image 508
Tommy O'Dell Avatar asked Nov 18 '25 00:11

Tommy O'Dell


1 Answers

After speaking with the package maintainer, this looks like a bug, and they're hoping to fix it in the next release (which will be 1.1-11)

like image 181
Tommy O'Dell Avatar answered Nov 19 '25 14:11

Tommy O'Dell