Perl 无法执行 sybase 存储过程

发布于 2025-01-16 23:40:33 字数 1019 浏览 1 评论 0原文

我开始使用 perl 和 sybase。我正在尝试执行存储过程

use strict;
use warnings FATAL => 'all';
use DBI qw(:sql_types);
use DBD::Sybase;
use Data::Dumper;

my $dbh = DBI->connect($connect,$usr,$pwd)or die "Couldn't connect!\n" . DBI->errstr;
my $sth = $dbh->prepare("exec progress_web \@id=?, \@as_select=?");
$sth->bind_param(1,5374,SQL_INTERGER);
$sth->bind_param(2,1,SQL_INTERGER);
$sth->execute;
while(my $row = $sth->fetch) {
  print Dumper($row);
}
$sth->finish;
$dbh->disconnect;

连接正常,但是当我尝试执行存储过程时,我

Bareword "SQL_INTERGER" not allowed while "strict subs" in use at ./sybase_test.pl line 15.
Bareword "SQL_INTERGER" not allowed while "strict subs" in use at ./sybase_test.pl line 16.
Execution of ./sybase_test.pl aborted due to compilation errors.

收到 Removing use strict 和警告。

DBI::st=HASH(0x55ad3d830630)->bind_param(...): attribute parameter 'SQL_INTERGER' is not a hash ref at ./sybase_test.pl line 16.

I am getting started using perl and sybase. i am trying to execute a stored procedure

use strict;
use warnings FATAL => 'all';
use DBI qw(:sql_types);
use DBD::Sybase;
use Data::Dumper;

my $dbh = DBI->connect($connect,$usr,$pwd)or die "Couldn't connect!\n" . DBI->errstr;
my $sth = $dbh->prepare("exec progress_web \@id=?, \@as_select=?");
$sth->bind_param(1,5374,SQL_INTERGER);
$sth->bind_param(2,1,SQL_INTERGER);
$sth->execute;
while(my $row = $sth->fetch) {
  print Dumper($row);
}
$sth->finish;
$dbh->disconnect;

The connection is ok, but when I try to execute the stored procedure i get

Bareword "SQL_INTERGER" not allowed while "strict subs" in use at ./sybase_test.pl line 15.
Bareword "SQL_INTERGER" not allowed while "strict subs" in use at ./sybase_test.pl line 16.
Execution of ./sybase_test.pl aborted due to compilation errors.

Removing use strict and warning i get.

DBI::st=HASH(0x55ad3d830630)->bind_param(...): attribute parameter 'SQL_INTERGER' is not a hash ref at ./sybase_test.pl line 16.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

や莫失莫忘 2025-01-23 23:40:33

它不是 SQL_INTERGER,而是 SQL_INTEGER。如文档中所列。

您应该知道删除 use strict 并不能解决问题,它会隐藏问题。这可能会让人感到安慰,但没有帮助。

It is not SQL_INTERGER, it is SQL_INTEGER. As listed in the documentation.

You should know that removing use strict doesn't solve problems, it hides them. It might feel comforting, but it doesn't help.

穿透光 2025-01-23 23:40:33

您可以使用:

$sth->bind_param(1,5374,4);
$sth->bind_param(2,1,4);
$sth->execute;

You can use instead:

$sth->bind_param(1,5374,4);
$sth->bind_param(2,1,4);
$sth->execute;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文