Oracle/PHP - UPDATE 上的 ORA-00911 无效字符
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3523908/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Oracle/PHP - ORA-00911 invalid character on UPDATE
提问by Arturo
I'm running a PHP script that updates a table from an Oracle DB instance.
我正在运行从 Oracle 数据库实例更新表的 PHP 脚本。
First, I receive an object with JSON:
首先,我收到一个带有 JSON 的对象:
[{
"lot": "KLMHA17N9N00",
"requestor": "B10078",
"id": "FRESHLOT",
"username": "B26696",
"password": "B26696"
}, {
"lot": "KLMHA17R1800",
"requestor": "B10078",
"id": "FRESHLOT"
}]
(This JSON is known to have no problems, since I've been using this in other projects.)
(已知此 JSON 没有问题,因为我一直在其他项目中使用它。)
Then, I create the query after parsing the results to the $rmrid object:
然后,我在将结果解析为 $rmrid 对象后创建查询:
$db_query = "update ao_lots
set RMRID='".$rmrid->requestor."-".$rmrid->id."'
where ALOT_NUMBER='".$rmrid->lot."';";
If I echo the query, I get this:
如果我回显查询,我会得到这个:
update ao_lots
set RMRID='B10078-FRESHLOT'
where ALOT_NUMBER='KLMHA17N9N00';
I don't see any problems here, but when I execute the query, I get this warning and nothing is updated:
我在这里没有看到任何问题,但是当我执行查询时,我收到此警告并且没有任何更新:
WARNING: oci_execute() [function.oci-execute]: ORA-00911: invalid character
警告:oci_execute() [function.oci-execute]:ORA-00911:无效字符
I did some searching on that error code, but I couldn't fix it with the info that I found.
我对该错误代码进行了一些搜索,但无法使用找到的信息修复它。
Any suggestions would be greatly appreciated.
任何建议将不胜感激。
回答by Gary Myers
The semi-colon isn't needed at the end of the SQL statement.
SQL 语句末尾不需要分号。
It is used by SQL*Plus and most other tools to indicate "I've finished writing the statement, now go execute it"
SQL*Plus 和大多数其他工具使用它来指示“我已经完成了语句的编写,现在去执行它”