简体   繁体   中英

Perl Dbi and stored procedures

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

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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