3 月,1 周
Questions & Answers
23203
strInsertQuery="INSERT INTO SYNPACKAGEFREEUSAGEMAPPING (PACKAGEID,SERVICEID,PRIORITY,MAPPINGID,ATTRIBUTEVALUE,FREEUSAGE,UOM,PARAMSTR1,UNITCREDITPOLICYDETAILID) VALUES (?,?,?,?,?,?,?,?,?)";
newPstmt=newCon.prepareStatement(strInsertQuery);
newPstmt.setString(1,strProductId);
newPstmt.setString(2,strUPGServiceId);
newPstmt.setInt(3,0);
if(FieldMappingrs.next())
{
newPstmt.setLong(4,FieldMappingrs.getLong(1));
}
newPstmt.setString(5,ucpDetailData.getCreditattributevalue());
for(Iterator itrColUnitCreditDetail=ucpData.iterator();itrColUnitCreditDetail.hasNext();)
{
unitCreditData = (UnitCreditDetailData)itrColUnitCreditDetail.next();
if(ucpDetailData.getUnitcreditpolicydetailid().equals(unitCreditData.getUnitcreditpolicydetailid()))
{
debugLog(PackageConstant.PACKAGE_MODULE_NAME,"ServicePackageSessionBean:createFreeUsageServiceDetails() unitCreditData "+ unitCreditData);
newPstmt.setDouble(6,unitCreditData.getEndvalue());
}
debugLog(PackageConstant.PACKAGE_MODULE_NAME,"Insert record successfull"+ ucpDetailData);
}
newPstmt.setString(7,ucpDetailData.getUom());
newPstmt.setString(8,ucpDetailData.getCreditattribute());
newPstmt.setString(9,ucpDetailData.getUnitcreditpolicydetailid());
newPstmt.executeUpdate();
# 1 楼答案
你的问题就在这个街区
如您所见,如果
.next()
返回false
,您将不会在index
4传递参数我建议,如果你能传递到表0而不是空,那么使用这个
或者,如果它是必需的值,只需抛出一个
exception
# 2 楼答案
看看这个:
所以你要有条件地设置参数4
如果
FieldMappingsrs.next()
返回false,您想插入什么?(我怀疑这就是正在发生的事情。)尝试在else
块中将其设置为适当的值