免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12
最近访问板块 发新帖
楼主: herolyh
打印 上一主题 下一主题

perl 如何调用存储过程? [复制链接]

论坛徽章:
0
11 [报告]
发表于 2007-02-07 19:45 |只看该作者
my $sth=$dbh->prepare("call key_price_reset('$tmpkey','$update');
");
$sth->execute();
$sth->finish();
执行结果:
[Wed Feb  7 19:42:48 2007] first1.cgi: DBD::Oracle::st execute failed: ORA-00911
: invalid character (DBD ERROR: error possibly near <*> indicator at char 35 in
'call key_price_reset('again001','')<*>;
[Wed Feb  7 19:42:48 2007] first1.cgi: ') [for Statement "call key_price_reset('
again001','');
[Wed Feb  7 19:42:48 2007] first1.cgi: "] at first1.cgi line 68.

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
12 [报告]
发表于 2007-02-07 20:30 |只看该作者
原帖由 herolyh 于 2007-2-7 19:45 发表
my $sth=$dbh->prepare("call key_price_reset('$tmpkey','$update');
");
$sth->execute();
$sth->finish();
执行结果:
[Wed Feb  7 19:42:48 2007] first1.cgi: DBD::Oracle::st execu ...

红色的部分是什么 存储过程带参数

论坛徽章:
0
13 [报告]
发表于 2007-02-07 20:32 |只看该作者
直接用执行system调用echo "exec procs"|sqlplus -s user/passwd 算了

论坛徽章:
0
14 [报告]
发表于 2007-02-08 19:05 |只看该作者
my $sth=$dbh->prepare("BEGIN key_price_reset(?,?);END;");
$sth->bind_param( 1,$key);
$sth->bind_param_inout( 2, \$update, 1000 );
$sth->execute();
这样就可以了,不明白!问题已解决!

论坛徽章:
0
15 [报告]
发表于 2007-02-09 09:25 |只看该作者
原帖由 herolyh 于 2007-2-8 19:05 发表
my $sth=$dbh->prepare("BEGIN key_price_reset(?,?);END;";
$sth->bind_param( 1,$key);
$sth->bind_param_inout( 2, \$update, 1000 );
$sth->execute();
这样就可以了,不明白!问 ...



想请问一下sth->bind_param_inout( 2, \$update, 1000 );
这个参数是可以输入也可以返回值的吗?如果是可以返回的应该怎么样获取?可以解释一下这个写法吗?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP