Perl 调用 mysql 存储过程并获得返回值的脚本
复制代码 代码如下:
$stmt=$my_db->prepare("SELECT isodd(?)") or die($my_db->error);
$stmt->bind_param('i',$aNumber) or die($stmt->error);
$stmt->execute() or die($stmt->error);
$stmt->bind_result($isodd);
$stmt->fetch();
if ($isodd == 1 )
printf("%d is an odd numbern",$aNumber);
else
printf("%d is an even numbern",$aNumber);