I am connecting to an Oracle database with RJDBC, and creating a data frame 
with dbGetQuery.  When I get values return, values which are NULL in the 
database are being returned as 0 from my query.  How can I have them returned 
as <NA>?

I am query like the following.

--
require(RJDBC)

drv <- 
JDBC("oracle.jdbc.driver.OracleDriver","/usr/local/ojdbc/ojdbc14.jar","'")
conn <- dbConnect(drv, "dbc:oracle:thin:@ADDRESS","user","pass")
results <- dbGetQuery("select rownum, col1 from table where col1 is null")
--

> results

   ROWNUM COL1
1       1    0
2       2    0
3       3    0
4       4    0
5       5    0

I'd rather see:

> results

   ROWNUM COL1
1       1    NA
2       2    NA
3       3    NA
4       4    NA
5       5    NA

--

-albert
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to