[R] Problem in fetching from Oracle

Minghua Yao myao at ou.edu
Mon May 12 17:45:27 CEST 2003



Thanks for the reply.

xxx<-NULL doesn't help.

If I disconnected the connection, then both
----------------------------------------------------------------------------
>channel <- dbConnect(ora, user = "scott", password="tiger",
dbname="abcdef")
>rs <- dbSendQuery(channel, "select * from USArrests")
>while(!dbHasCompleted(rs))
  {
    df <- fetch(rs, n = 5000)
  }
>df
----------------------------------------------------------------------------
and
----------------------------------------------------------------------------
>channel <- dbConnect(ora, user = "scott", password="tiger",
dbname="abcdef")
>rs <- dbSendQuery(channel, "select * from USArrests")
>while(!dbHasCompleted(rs))
  {
    xxx <- fetch(rs, n = 5000)
  }
>xxx
----------------------------------------------------------------------------
work.

So, the reason may be we shouldn't have had the previous connection when
using fetch. But I did.

Minghua

-----Original Message-----
From: Spencer Graves [mailto:spencer.graves at PDF.COM]
Sent: Monday, May 12, 2003 10:28 AM
To: Minghua Yao
Cc: R Help
Subject: Re: [R] Problem in fetching from Oracle


1.  "xxx" was defined local to the "while" statement and disappeared
after it.  Have you tried the following:

xxx <- NULL
while(~dbHasCompleted(rs)){
	xxx <- c(xxx, fetch(rs, n=5000)
}

I have not accessed Oracle, so I don't know if this will work.  However,
it will solve one problem with your code.

2.  "df" is the density function for the F distribution, which is what
you got when you requested it after the "while".

hth.  spencer graves

Minghua Yao wrote:
> Dear all,
>
> I tried the following in R:
>
>  >library(ROracle)
>  >ora <- dbDriver("Oracle")
>  >channel <- dbConnect(ora, user = "scott",
> password="tiger",dbname="abcdef")
>  >rs <- dbSendQuery(channel, "select * from USArrests")
>
>  >while(!dbHasCompleted(rs))
>   {
>   	xxx <- fetch(rs, n = 5000)
>   }
> + + + > xxx
> Error: Object "xxx" not found
>
> If I changed xxx to df and typed df, I got
> + + + > df
> function (x, df1, df2, log = FALSE)
> .Internal(df(x, df1, df2, log))
> <environment: namespace:base>
>
>
> Please help. Thanks.
>
> Minghua
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help




More information about the R-help mailing list