我有以下java代码,其中executeUpdate()的输出是在int中捕获的,值始终为1.对于输入值,DB中没有行但它仍然返回1.为什么?我错过了什么吗?
/*******************Java code *************/
/**** Code to get connection above ***/
CallableStatement oraCallStmt = null;
try {
oraCallStmt = connection.prepareCall(
"{ call XXXXX.UPDATEMEMBERNUMBER(?,?)}"
);
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
return ;
}
try {
//Reading a comma delimited file to get two column values
//One into the where clause and one into the update clause
while ((str = in.readLine()) != null) {
String[] ar = str.split(",");
oraCallStmt.setString(1,ar[0].trim());
oraCallStmt.setString(2,ar[1].trim());
int output = oraCallStmt.executeUpdate();
//The output returns 1 always even if the row doesn't exist
System.out.println(str +'-'+output);
//Writing the result to another file
bw.write(str +'-'+output);
bw.newLine() ;
bw.flush();
}
bw.close();
}catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
/************pl-sql package*******************/
PROCEDURE UpdateMemberNumber(CUSTID_INP IN VARCHAR,
MEM_NUM_INP IN VARCHAR) IS
BEGIN
UPDATE GENESIS.CUSTOMER
SET MEMBER_NUMBER = MEM_NUM_INP
WHERE CUSTOMER_ID = CUSTID_INP ;
END UpdateMemberNumber ;