[R-sig-DB] ROracle problem?

Don Allen don @end|ng |rom de|ph|outpo@t@com
Thu Jan 3 17:04:09 CET 2008


Our configuration: R 2.6.1, DBI_0.2-4, ROracle_0.5-9, all running on a
dual-processor 64-bit Ubuntu 6.06 system.

If you run the following

drv <- Oracle()
conn <- dbConnect(drv, '<oracle user>/<password>')
sql <- "select sysdate from dual where to_date(:1) = to_date(:1)"
ps <- dbPrepareStatement(conn=conn,
                             statement=sql,
                             bind = c('character'))

You get:

> source('test.r')

Error in oraPrepareStatement(conn, statement, bind, ...) :
 RS-DBI driver: (number of parameters must equal ncol(data))

Enter a frame number, or 0 to exit

1: source(" test.r")
2: eval.with.vis(ei, envir)
3: eval.with.vis(expr, envir, enclos)
4: dbPrepareStatement(conn = conn, statement = sql, bind =
c("character"))
5: .valueClassTest({
6: is(object, Cl)
7: .class1(object)
8: .class1(object)
9: oraPrepareStatement(conn, statement, bind, ...)

Selection:

Changing the example to

drv <- Oracle()
conn <- dbConnect(drv, '<oracle user>/<password>')
sql <- "select sysdate from dual where to_date(:1) = to_date('2007-01-01')"
ps <- dbPrepareStatement(conn=conn,
                             statement=sql,
                             bind = c('character'))

works fine -- no error.

The (nonsensical query) in the example is based on a much more
complicated (not nonsensical) query that failed the same way. The
common thread is that the example and the real query both make
multiple references to the same data column. Either I'm not
understanding something, or there's a bug. Any help would be
appreciated.

Thanks --
Don Allen
Delphi Capital Management




More information about the R-sig-DB mailing list