ODBC: Obtaining output params

I’m fairly new to Ruby, as well as using the ODBC library. So far, I’ve
had very little problems using it… running queries, stored procs,
etc. However, I cannot seem to get an output parameter from a stored
proc that I run.

Here’s a basic example of my DB connection and queries…


require ‘odbc’

dbcon = ODBC.connect( host, username, password )

outVar = -1
queryStatement = “call sp_TestSP( 2, #{@outVar} )”
query = dbcon.prepare( queryStatement )
query.execute()

At this point I can retrieve the return value if the stored proc
returns anything, but I cannot for my life figure out how to get the
output parameter that was set. @outVar is not changed, though I know
the stored proc is doing it internally.

Any help on retreiving an output param that is set would be great!

Thanks for any help!