简体   繁体   English

Perl Dbi和存储过程

[英]Perl Dbi and stored procedures

How can i retrive the return value of stored procedure by using perl and the dbi against sql server ? 如何通过使用perl和针对sql server的dbi来检索存储过程的返回值? could someone provide example. 有人可以举例吗。

There are examples in DBD::ODBC t/ dir (see 20SqlServer.t). DBD :: ODBC t / dir中有一些示例(请参阅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. 现在$ output应包含您返回的任何程序。 Make sure you set then length in bind_param_inout sufficiently (the 100 above). 确保在bind_param_inout中设置了足够的长度(上面的100)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM