perl 执行sybase存储过程失败

Perl fails to execute sybase stored procedure

我开始使用 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.

删除 use strict 和我收到的警告。

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

不是SQL_INTERGER,是SQL_INTEGER。如documentation.

中所列

您应该知道,删除 use strict 并不能解决问题,只会隐藏问题。这可能会让人感到安慰,但无济于事。

您可以改用:

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