[R-sig-DB] problem with ROracle calls from a package

Rajarshi Guha r@j@r@h|@guh@ @end|ng |rom gm@||@com
Tue Aug 4 03:59:45 CEST 2009


Hi, I have some R code that uses a OracConnection object to query a
database. The function is something like

myfunction <- function(con, .....) {
  sql <- paste("SELECT pd.plate_info_id, pd.col_index, ",data.cols,
               " FROM plate_data pd ",
               " WHERE pd.plate_info_id IN ",
               " (SELECT pi.plate_info_id ",
               " FROM plate_info pi ",
               " WHERE pi.protocol_name = '",protocol.name,"')",
               " AND pd.type_index = ", type.index," and pd.layer_index =
",layer.index,
               " order by pd.plate_info_id ,pd.col_index", sep='',
collapse='')
  res <- dbSendQuery(con, statement=sql)
....
....
}

When I source the file containing this function and pass it a connection
object it works fine.

However, when I bundle this function into a package and install the package
and then call the function, I get

Error in oraExecStatement(ps, ora.buf.size = as(ora.buf.size, "integer")) :
  expired or invalid prepared statement
Error in oraExecDirect(conn, statement, ...) :
  could not exec direct statement SELECT pd.plate_info_id, pd.col_index,
pd.value0, pd.value1, pd.value2, pd.value3, pd.value4, pd.value5, pd.value6,
pd.value7, pd.value8, pd.value9, pd.value10, pd.value11, pd.value12,
pd.value13, pd.value14, pd.value15 FROM plate_data pd  WHERE
pd.plate_info_id IN  (SELECT pi.plate_info_id  FROM plate_info pi  WHERE
pi.protocol_name = 'cptk-3-vo') AND pd.type_index = 22 and pd.layer_index =
0 order by pd.plate_info_id ,pd.col_index

Has anybody seen this behavior before?
-- 
Rajarshi Guha

	[[alternative HTML version deleted]]




More information about the R-sig-DB mailing list