Oracle/PHP - ORA-00911 更新时的无效字符
我正在运行一个 PHP 脚本,该脚本从 Oracle 数据库实例更新表。
首先,我收到一个带有 JSON 的对象:(
[{
"lot": "KLMHA17N9N00",
"requestor": "B10078",
"id": "FRESHLOT",
"username": "B26696",
"password": "B26696"
}, {
"lot": "KLMHA17R1800",
"requestor": "B10078",
"id": "FRESHLOT"
}]
众所周知,这个 JSON 没有问题,因为我一直在其他项目中使用它。)
然后,我在将结果解析为 $rmrid 对象后创建查询:
$db_query = "update ao_lots
set RMRID='".$rmrid->requestor."-".$rmrid->id."'
where ALOT_NUMBER='".$rmrid->lot."';";
如果我 echo查询,我得到这个:
update ao_lots
set RMRID='B10078-FRESHLOT'
where ALOT_NUMBER='KLMHA17N9N00';
我在这里没有看到任何问题,但是当我执行查询时,我收到此警告并且没有任何更新:
警告:oci_execute() [function.oci-execute]:ORA-00911:无效字符
我对该错误代码进行了一些搜索,但无法使用找到的信息修复它。
任何建议将不胜感激。
I'm running a PHP script that updates a table from an Oracle DB instance.
First, I receive an object with 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.)
Then, I create the query after parsing the results to the $rmrid object:
$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
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
SQL 语句末尾不需要分号。
SQL*Plus 和大多数其他工具使用它来指示“我已经完成了语句的编写,现在去执行它”
The semi-colon isn't needed at the end of the SQL statement.
It is used by SQL*Plus and most other tools to indicate "I've finished writing the statement, now go execute it"