[R-sig-DB] ROracle fetch problems
Joerg Schaber
Joerg@Sch@ber @end|ng |rom uv@e@
Mon Oct 27 13:31:12 CET 2003
Hi,
I am using the ROralce interface (version 0.5-0) for accessing my Oracle
database from R 1.7.1 (64 bit version, powerpc-ibm-aix5.1.0.0). The
connection works fine, however, I get some strange results using
'fetch'. 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:
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
>
> dbGetInfo(ora)
$drvName
[1] "Oracle (ProC/C++)"
$connectionIds
$connectionIds[[1]]
<OraConnection:(3801338,0)>
$"fetch_default_rec"
[1] 500
$managerId
<OraDriver:(3801338)>
$length
[1] 10
$"num_con"
[1] 1
$counter
[1] 1
$clientVersion
[1] "0.5-0"
Any idea what's the problem here?
Greetings,
joerg
--
----------------------------------------------------------
Jörg Schaber
Instituto Cavanilles de Biodiversidad y Biologia Evolutiva
Universidad de Valencia Tel.: ++34 96 354 3666
A.C. 22085 Fax.: ++34 96 354 3670
46071 Valencia, España email : jos using uv.es
More information about the R-sig-DB
mailing list