[R] sqlUpdate RODBC

koj jens.koch at gmx.li
Wed Feb 3 09:09:03 CET 2010


Dear all,

I using R version 2.9.0 on Windows XP and want to insert data from a data
frame in R into a oracle database via sqlUpdate with the package RODBC.

My example is the following:

TEST0<-data.frame(NR=c(1,2,600),NAME=c("JK","TR","AR"),
DATUM=c("2009-01-01","2010-01-02","2010-06-09"))

If I create the table in the database with sqlSave all is okay. sqlUpdate
works fine and the update happens, but "DATUM" is "VARCHAR2". Is there a
possibility with RODBC to adjust the format according to my preferences?

In my opinion the problem is the format of the variable "DATUM." If I create
the table manually in the oracle database and define data type "DATE" for
"DATUM", I receive a error message after starting sqlUpdate and R shuts
down. There must be problem with the date format.

So I try the following:

sqlQuery(channel,"alter session set NLS_DATE_FORMAT='YYYY-MM-DD'")

Unfortunately without sucess. I tried a lot of variations with the format.
In R I worked with as.Date or strptime, too.

The error message is the following:

"Failed exec in Update 22007...Fehler in Parameter 2: Überlauf im
Datetime-Feld"

I don't know, if the error is a driver problem, a problem of the database or
a problem of R.

Has anyone experiences with this problem? 

Thank you very much in advance,


Jens.

-- 
View this message in context: http://n4.nabble.com/sqlUpdate-RODBC-tp1460867p1460867.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list