调取存储过程

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);// 设置输入参数的值

cs.registerOutParameter(2, OracleTypes.NUMBER);// 注册输出参数的类型

returncs;

}

},newCallableStatementCallback() {

publicObject doInCallableStatement(CallableStatement cs)throwsSQLException, DataAccessException {

cs.execute();

returncs.getString(2);// 获取输出参数的值

}

});

return;

}

你可能感兴趣的:(调取存储过程)