[R] Oracle fetch problems

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Oct 27 13:10:29 CET 2003


Could you at least tell us which R package(s) and versions you are using 
here?

You can access Oracle databases by ROracle and RODBC and perhaps other
ways.  If this is ROracle, it would be better to use the R-sig-DB list
(see https://www.stat.math.ethz.ch/mailman/listinfo) or talk directly to
the author.

On Mon, 27 Oct 2003, Joerg Schaber wrote:

> relating to my former messages concerning the strange fetch problems I 
> have, I found out that 'fetch' fetches only every second row of the 
> 'native' SQL-results and fills up the rest of the rows with zeros.
> Here a draft for the native SQL-query:
> 
> 12:43:07 SQL>  SELECT OBS_DAY, OBS_YEAR, STAT_ID FROM WILD_PHENO_OBS 
> WHERE PHASE_ID=7 AND OBS_YEAR BETWEEN 1951 AND 2000 order by stat_id, 
> obs_year, obs_day;
> PLEASE HIT RETURN TO CONTINUE
> 
>    OBS_DAY   OBS_YEAR    STAT_ID
> ---------- ---------- ----------
>        133       1954   11110000
>        140       1955   11110000
>        147       1956   11110000
>        133       1957   11110000
>        146       1958   11110000
>        118       1959   11110000
>        132       1960   11110000
>        120       1961   11110000
>        138       1962   11110000
>        144       1963   11110000
> 
> Here what fetches R:
> 
>  >  DBres <- dbSendQuery(DBcon, "SELECT OBS_DAY, OBS_YEAR, STAT_ID FROM 
> WILD_PHENO_OBS WHERE PHASE_ID=7 AND OBS_YEAR BETWEEN 1951 AND 2000 order 
> by stat_id, obs_year, obs_day")
>  >  fetch(DBres,n=10)
>   OBS_DAY OBS_YEAR  STAT_ID
> 0     140     1955 11110000
> 1     133     1957 11110000
> 2     118     1959 11110000
> 3     120     1961 11110000
> 4     144     1963 11110000
> 5       0        0 11110000
> 6       0        0 11110000
> 7       0        0 11110000
> 8       0        0 11110000
> 9       0        0 11110000
>  >
> 
> Any idea what's the problem here?
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 
> 

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list