[R] Oracle fetch problems

Joerg Schaber Joerg.Schaber at uv.es
Mon Oct 27 12:49:08 CET 2003


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?




More information about the R-help mailing list