我正面临一个问题。我不知道这是否正确。
我正在执行一个准备好的语句查询,它将返回真/假作为布尔值。当查询应该成功执行时,它会以布尔值的形式返回真,但会以假的形式返回。
我该怎么办?
代码如下:
String updateListQuery = "UPDATE RECON_EXCEPTION_ETM_DCR SET GROUP_ID = ?, ASSIGN_DT = SYSDATE WHERE RECON_ID = ? AND UPPER(TRIM(REASON_DESC)) <> 'RECONCILED' AND TRUNC(DUTY_DATE) = ? " ;
try{
conn = Connect.getConn();
getGroupNameStmt = conn.prepareStatement(updateListQuery);
getGroupNameStmt.setString(1, groupId);
getGroupNameStmt.setString(2, reconId);
getGroupNameStmt.setString(3, defFormatDt);
flag = getGroupNameStmt.execute();
flag = true;
}catch(SQLException e){
flag = false;
e.printStackTrace();
}finally{
try{
conn.commit();
getGroupNameStmt.close();
conn.close();
}catch(SQLException e){
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)