我開始使用 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.
洗掉我得到的使用嚴格和警告。
DBI::st=HASH(0x55ad3d830630)->bind_param(...): attribute parameter 'SQL_INTERGER' is not a hash ref at ./sybase_test.pl line 16.
uj5u.com熱心網友回復:
它不是 SQL_INTERGER,而是 SQL_INTEGER。如檔案中所列。
您應該知道,洗掉use strict并不能解決問題,它會隱藏問題。這可能會讓人感到安慰,但并沒有幫助。
uj5u.com熱心網友回復:
您可以改用:
$sth->bind_param(1,5374,4);
$sth->bind_param(2,1,4);
$sth->execute;
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/450429.html
上一篇:如何檢查命令的退出狀態?
