Use of bind variables using OCI8

  • Thread starter Harnish Botadra
  • Start date
H

Harnish Botadra

Hey Guys,

I am having some issues with the use of bind variables...

When I use...

------------
connFC = OCI8.new(<mydb>)

connFC.exec("SELECT * from emp where id = #{id}") { |row|
}
------------

it works perfectly fine...but when I modify to use bind variables for
Number type...

-------------
connFC = OCI8.new(<mydb>)

cursorFC = connFC.parse("SELECT * from emp where id = :1")
cursorFC.bind_param(1, id)

cursorFC.exec("SELECT * from emp where id = #{id}") { |row|
}
-------------

I get no resultset...can you please tell me, what I might be missing?
Do, I need to instantiate cursorFC to OCI8::Cursor or anything else,
which I might be missing? Thanks for your help.

---Harnish
 
H

Harnish Botadra

Thanks guys...

My issue got resolved..

I was missing the fetch method...

-------------------------------
connFC = OCI8.new(<mydb>)

cursorFC = connFC.parse("SELECT * from emp where id = :1")
cursorFC.bind_param(1, id)

cursorFC.exec()

cursorFC.fetch() { |row|
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

[ANN] ruby-oci8 2.0.5 0
[ANN] ruby-oci8 1.0.0 0
[ANN] ruby-oci8 1.0.6 and 2.0.2 2
[ANN] ruby-oci8 1.0.1 4
[ANN] ruby-oci8 2.0.4 0
[ANN] ruby-oci8 2.0.3 and 1.0.7 1
[ANN] ruby-oci8 0.1.10 4
Confused about OCI8 7

Members online

Forum statistics

Threads
473,996
Messages
2,570,238
Members
46,826
Latest member
robinsontor

Latest Threads

Top