[R] Core dump using DBI/ROracle

Mark Dalphin mdalphin at amgen.com
Wed Sep 24 18:57:29 CEST 2003


Hi,

Has anyone seen this problem before, and does anyone have a solution?

When I query a database using DBI and ROracle to retrieve a date in a format 
other than the system default, I get a core dump.

System: Redhat Linux 7.3
uname: Linux 2.4.20-20.7smp #1 SMP Mon Aug 18 14:46:14 EDT 2003 i686
Oracle version 8i
R --version: R 1.7.1 (2003-06-16).
DBI_0.1-6, ROracle_0.5-0

Start up R, load libraries and create a connection to DB:
> library(DBI)
> library(ROracle)
> conn <- dbConnect("Oracle", dbname='EPIMS', user='XXX', pass='XXX')

Here is an example of a query that works:
> d <- dbGetQuery(conn,
	'SELECT HybridDate FROM Hybridization WHERE ExperimentID=2717')
> str(d)
`data.frame':   54 obs. of  1 variable:
 $ HYBRIDDATE: chr  "22-MAY-2003 00:00:00" "22-MAY-2003 00:00:00" "17-JUL-2003 
00:00:00" "17-JUL-2003 00:00:00" ...

Here is a query which dumps core (the sql is all on one line):
> d <- dbGetQuery(conn,
	"SELECT TO_CHAR(HybridDate, 'YYYY-MM-DD') FROM Hybridization WHERE 
ExperimentID=2717")
Segmentation fault (core dumped)

My current work around is to accept the Oracle default date format and then 
use R's strpdate to convert to a date format that I want. I don't like coding 
this way, however, as it relies on the Oracle date format remaining static; I 
prefer to code more 'defensively'.

I assume this is a bug in DBI/ROracle processing of functions in the selected 
variables, but I don't know. Any suggestions are welcome.

Thanks,
Mark

-- 
Mark Dalphin                          email: mdalphin at amgen.com
Mail Stop: 29-2-A                     phone: +1-805-447-4951 (work)
One Amgen Center Drive                       +1-805-375-0680 (home)
Thousand Oaks, CA 91320                 fax: +1-805-499-9955 (work)




More information about the R-help mailing list