# How can I get value of output parameter using DBI library

**URL:** <https://www.ruby-forum.com/t/how-can-i-get-value-of-output-parameter-using-dbi-library/138375>\
**Category:** Ruby\
**Created:** [May 22, 2008, 12:26pm UTC](https://www.ruby-forum.com/t/how-can-i-get-value-of-output-parameter-using-dbi-library/138375 "2008-05-22T12:26:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [May 22, 2008, 12:26pm UTC](https://www.ruby-forum.com/t/how-can-i-get-value-of-output-parameter-using-dbi-library/138375/1 "2008-05-22T12:26:46Z")

</div>

I’m coding with DBI and MSSQL.

I’ve connected to the server with following line of code.

dbh = DBI.connect(‘DBI:ODBC:driver\_name’, ‘user\_name’, ‘user\_pwd’)

…and if it suppose that there’s a stored procedure named add\_user  
has return value and three parameters(two are input param and the last  
one is output param).

I’ve reeeeeeeeeeally tried to search the solution from the WEB and  
just follow some code(e.g.  
[http://ruby-oci8.rubyforge.org/en/FAQ\_plsql\_out\_param.html](http://ruby-oci8.rubyforge.org/en/FAQ_plsql_out_param.html)).  
Next several lines of code is it result…

sth\_db = dbh.prepare(“{ ? = call add\_user(1, ‘name’, ?) }”)  
sth\_db.bind\_param(1, ’ ’ \* 50)  
sth\_db.bind\_param(2, ’ ’ \* 50)  
sth\_db.execute  
grp\_sn = sth\_db.func(:bind\_value, 2)

…but, does not work!

How can I complete my job! Give me some clue~ plz!
