gpt4 book ai didi

Perl Dbi 和存储过程

转载 作者:行者123 更新时间:2023-12-03 02:56:10 24 4
gpt4 key购买 nike

如何使用 perl 和 fbi 针对 sql server 检索存储过程的返回值?有人可以举个例子吗?

最佳答案

DBD::ODBC t/dir 中有示例(参见 20SqlServer.t)。基本上你是这样做的(不是一个完整的工作示例):

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

现在 $output 应该包含您的过程返回的任何内容。确保您在bind_param_inout中设置了足够的长度(上面的100)。

关于Perl Dbi 和存储过程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3051735/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com