http://sunbin123.iteye.com/blog/1007556
public voidprocTest()
{
String param2Value = (String)baseDao.getJdbcTemplate().execute(
newCallableStatementCreator() {
publicCallableStatement createCallableStatement(Connection con)throwsSQLException {
String storedProc ="{call proc3(?,?)}";// 調用的sql
CallableStatement cs = con.prepareCall(storedProc);
cs.setInt(1,18);// 設置輸入?yún)?shù)的值
cs.registerOutParameter(2, OracleTypes.NUMBER);// 注冊輸出參數(shù)的類型
returncs;
}
},newCallableStatementCallback() {
publicObject doInCallableStatement(CallableStatement cs)throwsSQLException, DataAccessException {
cs.execute();
returncs.getString(2);// 獲取輸出參數(shù)的值
}
});
return;
}