Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Use of bind variables using OCI8
Harnish Botadra
12/7/2007 11:38:00 PM
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
--
Posted via
http://www.ruby-...
.
1 Answer
Harnish Botadra
12/8/2007 12:55:00 AM
0
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|
}
-------------------------------
works like a charm! Thanks...
---Harnish
Harnish Botadra wrote:
> 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
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Use of bind variables using OCI8
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password