/**
* 测试代码,调用有返回值的存储过程
*/
public void procedureTest() throws ServiceBusException {
String sql = "{call testPackage.proceduret(?, ?)}"; //一个入参,一个出参
String message = (String) jdbcTemplate.execute(sql, new CallableStatementCallback<Object>() {
public Object doInCallableStatement(CallableStatement cs) throws SQLException, DataAccessException {
cs.setString(1, "code");
cs.registerOutParameter(2, Types.VARCHAR);
cs.execute();
return StringUtil.concat("程序包返回信息:", cs.getString(2));// 获取输出参数的值
}
});
logger.debug(message);
}
/**
* 测试代码,调用有返回值的程序包
*/
public void packageTest() throws ServiceBusException {
String sql = "{? = call TEST_PKG.of_stop_clinic_dict(?, ?)}"; //一个返回值,一个入参,一个出参
String message = (String) jdbcTemplate.execute(sql, new CallableStatementCallback<Object>() {
public Object doInCallableStatement(CallableStatement cs) throws SQLException, DataAccessException {
cs.registerOutParameter(1, java.sql.Types.VARCHAR);
cs.setString(2, "code");
cs.registerOutParameter(3, Types.VARCHAR);
cs.execute();
return StringUtil.concat("程序包返回信息:", cs.getString(1), "/", cs.getString(3));// 获取输出参数的值
}
});
logger.debug(message);
}