When used ROraclein R, I want to bind some parameters to the data, so I do this:
> dbh <- dbConnect('Oracle', 'user/pass@host.com:port/sid')
> st <- dbPrepareStatement(dbh, statement="SELECT x FROM mytab WHERE id=:1",
bind="character")
> st <- dbExecStatement(st, data.frame(id=c("9ae", "1f3"), stringsAsFactors=F))
> fetch(st)
x
0 FOO
Unexpectedly, it only uses the first row of the data frame for SELECT(if it used both rows, I would get 2 output rows in this case, and not 1), contrary to the ROracledocumentation:
An object that is dbPrepareStatementthen used along with data.frame(which should match the associated specification) in calls dbExecStatementto execute each line data.frame.
Am I doing it wrong or maybe the above wording applies only to INSERT/ operators UPDATE?