While using Ruby-DBI I am facing issues with parameter binding for where "in" queries. Two questions:
- How do I get sql generated after parameter binding?
- Does
in
parameter for sql work properly if using DBI and OCI8?
My code looks like this:
dbh = DBI.connect(setting[:tns], setting[:username], setting[:password])
开发者_高级运维#date and in_params are parameters to sql query.
#In the query they are seen as ? "Question marks"
sth = dbh.execute(File.read('import_values.sql'), date, in_params)
The query looks like this:
SELECT date, col1, col2
FROM TABLEX
WHERE date = ?
AND col1 not in ( ? )
Please help.
I re-factored code to not use "in".
精彩评论