spring+ibatis2 调用 oracle存储过程,每次调用的时候都执行三次存储过程

2025-05-11 16:20:53
推荐回答(1个)
回答1:

你这个问题看看下面的例子也许会明白,希望能帮到你,纯手打
String oMsg = "";

public String custSignUp(final Map map){
String sql = "{call CUST_SIGN_UP_PROC(?,?)}";
String o_Msg;
o_Msg =(String) this.getJdbcTemplate().execute(sql,new CallableStatementCallback(){
public String doInCallableStatement(CallableStatement cs) throws SQLException, DataAccessException {
String gLiceCode = (String) map.get("custLicenceCode");
// System.out.println("!!gLiceCode: " + gLiceCode);
cs.setString(1,gLiceCode);
cs.registerOutParameter(2,OracleTypes.VARCHAR);//注册返回参数类型
cs.executeUpdate();
oMsg = cs.getString(2);
// System.out.println("!!oMsg: " + oMsg);
return oMsg;
}
});
System.out.println("!!o_Msg: " + o_Msg);
return o_Msg;
}