this.getJdbcTemplate().execute(
new CallableStatementCreator() {
public CallableStatement createCallableStatement(Connection con) throws SQLException {
String storedProc = "{call updatetractractcode(?, ?)}";// 調(diào)用的存儲(chǔ)過程
CallableStatement cs = con.prepareCall(storedProc);
cs.setInt(1, contractId);// 設(shè)置輸入?yún)?shù)的值
cs.registerOutParameter(2, java.sql.Types.INTEGER);// 注冊(cè)輸出參數(shù)的類型
return cs;
}
}, new CallableStatementCallback() {
public Object doInCallableStatement(CallableStatement cs) throws SQLException, DataAccessException {
cs.execute();
return cs.getString(2);// 獲取輸出參數(shù)的值
}
});