我正在尝试使用perl DBI将perl生成的数据插入到oracle数据库表中。这是我第一次尝试这样做,这可能是我犯了一个简单的错误。
我现在正在使用的是:
$dbh = DBI->connect ('dbi:Oracle:geosgen','student','train')
|| die "Database connection not made: $DBI::errstr";
$sql = "INSERT INTO MYTEST VALUES ($series, $sheet, $maxlat, $minlat, $maxlong, $minlong)";
$create = $dbh->do($sql);
print "Content-type:text/html\n\n\n";
if($Create){
print "Success";
}
else{
print "Failure<br/>$DBI::errstr";
}
我得到的输出是这样的:
DBD::Oracle::db do failed: ORA-00917: missing comma (DBD ERROR: error possibly near <*> indicator at char 36 in 'INSERT INTO MYTEST VALUES (Scotland <*>one inch 1st, Shetland Islands (North) (131), -0.6800, -1.4100, 60.9700, 60.6900)') [for Statement "INSERT INTO MYTEST VALUES (Scotland one inch 1st, Shetland Islands (North) (131), -0.6800, -1.4100, 60.9700, 60.6900)"] at bruce1.pl line 69, <INPUT> line 924.
Content-type:text/html
意味着它已成功读取数据但失败了。我希望我犯了一个菜鸟错误,有什么明显的吗?
答案 0 :(得分:4)
SQL要求引用字母常量:
插入最低价值('苏格兰1英寸1','设得兰群岛(北)(131)', - 0,6800,-1.4100,60.9700,60.6900)
如果你打印$ sql的值,你会发现它们不是。