Perl Dbi and stored procedures

冷暖自知 提交于 2019-12-24 02:09:39

问题


How can i retrive the return value of stored procedure by using perl and the dbi against sql server ? could someone provide example.


回答1:


There are examples in DBD::ODBC t/ dir (see 20SqlServer.t). Basically you do (not a full working example):

my $output;
my $input = 'fred';
my $sth = $dbh->prepare(q/{ ? = call myproc(?) }/);
$sth->bind_param_inout(1, \$output, 100);
$sth->bind_param(2, $input);
$sth->execute 

Now $output should contain whatever your procedure returned. Make sure you set then length in bind_param_inout sufficiently (the 100 above).



来源:https://stackoverflow.com/questions/3051735/perl-dbi-and-stored-procedures

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!