我编写了一个非常简单的 Perl 脚本,其中包含以下行。
my $q_it = $dbh->prepare('SELECT customdata.Field_ID,
customdata.Record_ID,
customdata.StringValue
FROM customdata
WHERE customdata.Field_ID='\'10012'\' && (StringValue LIKE '\'1%'\' OR StringValue LIKE '\'2%'\' OR StringValue LIKE '\'9%'\');
');
其中 customdata 是一个表。
但是,我总是遇到语法错误,抱怨“WHERER”子句:
Backslash found where operator expected at /home/wblocaladmin/Robert_2.pl line 18, near "'10012'\"
由于它是引用语句中的引用,所以我尝试像上面那样转义单引号。有没有人能帮我找出哪里出错了?
谢谢!