douchui7332 2019-04-18 07:15
浏览 279

ORA-01722:无效的数字,SQL in子句

I have the following query:

$query = "delete from document where document_lientype =:lienType and document_lienid =:lienId and document_id not in (:docsIds)";
$params = array(
    'lienType' => $lienType,
    'lienId'   => $lienId,
    'docsIds'  => implode(',',$docsIds)
);

When I dump $docsIds I get:

array(3) {
  [0] =>
  int(19357)
  [1] =>
  int(19358)
  [2] =>
  int(19378)
}

And when I dump implode(',',$docsIds) I get:

string(17) "19357,19358,19378"

When I run the query in my project I get the error ORA-01722: invalid number which means it is not being able to convert the docsIds into integers.

When I run the query in TOAD, it executes correctly; so the problem is coming from that in clause.

I tried to construct the string in all the ways I could imagine of, including: "'19357','19358','19378'" but I still get the same error.

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥15 对于相关问题的求解与代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
    • ¥15 保护模式-系统加载-段寄存器
    • ¥15 电脑桌面设定一个区域禁止鼠标操作
    • ¥15 求NPF226060磁芯的详细资料
    • ¥15 使用R语言marginaleffects包进行边际效应图绘制
    • ¥20 usb设备兼容性问题
    • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
    • ¥15 安装svn网络有问题怎么办