ORA-01008: not all variables bound

本文介绍了一个常见的数据库编程错误ORA-01008:not all variables bound,并给出了具体的解决方案。通过对比使用statement与prepareStatement的不同之处,解释了如何避免因参数绑定不当引发的问题。
ORA-01008: not all variables bound
源码:
pst = con.prepareStatement(sql);
pst.setString(1, newCard);
pst.setString(2, userMobilephone);
int i= pst.executeUpdate(sql);
修改如下:
pst = con.prepareStatement(sql);
pst.setString(1, newCard);
pst.setString(2, userMobilephone);
int i= pst.executeUpdate();

出错原因: pst.executeUpdate(sql) 代了参数
先前用的statement 后换为prepareStatement 一不小心耽误一个多小时,特地发表于此,供大家借鉴,哈哈哈,反面教材
09/08/25 06:54:45.29 LISTsrv.5:FwDbStmtOracle::execute:ERROR - rows processed=0: error executing statement (select l.appid,l.physicalStatus,l.physicalLocation,ecse.reservedFoup,lx.ReservedEqpName,lx.reservedPortId,ecse.reservedTime from fwlot l ,fablotext lx,FwEqpCurrentState ecs,FabEqpCurrentStateExt ecse where l.sysid=lx.PARENT and l.materialType='Durable' and ecs.sysid=ecse.parent and ecs.equipmentName=:portId and ecse.isReserved='T' and ecse.reservedFoup=l.appid and l.physicalLocation not in('ALKRI03',:portId) and l.physicalStatus not in('InEqp','InFab','EqpOnInOutPort','EqpOnInPort') and lx.ReservedPortId=:portId order by l.appid): Error(6-158) Mismatch between bind variable and input values - ORA-01008: not all variables bound 09/08/25 06:54:45.29 LISTsrv.5:FabListRule::CreateListFile:ERROR - Error(6-158) Mismatch between bind variable and input values - ORA-01008: not all variables bound 09/08/25 06:54:45.29 LISTsrv.5:fwsrvExecServerRule:finish executing rule LSTRETRANSPORTJOBLISTRULE 09/08/25 06:54:45.29 LISTsrv.5:FwTransaction::storeIt:ERROR - Error(6-158) reasonCode = Mismatch between bind variable and input values - ORA-01008: not all variables bound ; ruleReply = CANCELRULE 09/08/25 06:54:45.29 LISTsrv.5:FwTransaction::doIt:ERROR - transaction failure: Error(6-158) reasonCode = Mismatch between bind variable and input values - ORA-01008: not all variables bound ; ruleReply = CANCELRULE 09/08/25 06:54:45.29 LISTsrv.5:FwPublication::sendSmall:252 byte msg to (0x7555) reply is 0分析一下这个oracle报错的原因是什么
09-09
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值