[求助]DBD::Pg用bind_param说INSERT has more target columns than expr.
DBD::Pg 2.51
DBI 1.604
perl, v5.8.8 built for i686-linux-thread-multi
my $sth = $dbh->prepare( "INSERT INTO epdview (ac, firstchar, maxleft, maxright) VALUES ( ? )" );
my $str="‘AC’, 12, -2, 1";
$sth->execute($str);
报错:
DBD::Pg::st execute failed: ERROR: INSERT has more target columns than expressions at test.pl line 19.
换成 my $sth = $dbh->prepare( "INSERT INTO epdview (ac, firstchar, maxleft, maxright) VALUES ( ‘AC’, 12, -2, 1 )" ); 就可以。
是哪的问题?
还有就是,如何判断perl找到的是哪个版本的pm ?我的@INC有一堆地方,用包管理器和CPAN.pm的安装路径不同,虽然已经人工确定第一个是上面写的版本,但每次去翻目录看文件挺麻烦的。
————————————————————————————————————————————
$rv = $sth->execute(@bind_values)
但我只有一个问号,用array的话就:
DBD::Pg::st execute failed: called with 4 bind variables when 1 are needed at ./insert2db.pl line 98, <INFILE> line 11.
______________________________________________________
是否要指定4列就一定要用4个问号传递数据?