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 关于#r语言#的问题:(svydesign)为什么在一个大的数据集中抽取了一个小数据集
    • ¥15 C++使用Gunplot
    • ¥15 这个电路是如何实现路灯控制器的,原理是什么,怎么求解灯亮起后熄灭的时间如图?
    • ¥15 matlab数字图像处理频率域滤波
    • ¥15 在abaqus做了二维正交切削模型,给刀具添加了超声振动条件后输出切削力为什么比普通切削增大这么多
    • ¥15 ELGamal和paillier计算效率谁快?
    • ¥15 蓝桥杯单片机第十三届第一场,整点继电器吸合,5s后断开出现了问题
    • ¥15 file converter 转换格式失败 报错 Error marking filters as finished,如何解决?
    • ¥15 Arcgis相交分析无法绘制一个或多个图形