@Resource
NamedParameterJdbcTemplate jdbcTemplate;
public Object[] getvalueprem(String branchid, String productcode,
String providerid, String channeltype, String premiummode,
String premiumperiod, Double modalprem, int policyyear,
String basebankno) {
String sql = "{call pkg_operation_policyGather.getValuePrem(?,?,?,?,?,?,?,?,?,?,?,?,?)}";
Object[] obj = jdbcTemplate.getJdbcOperations().execute(sql,
new CallableStatementCallback() {
public Object[] doInCallableStatement(CallableStatement cs)
throws SQLException, DataAccessException {
//前面9個是輸入參數,后面4個是輸出參數
cs.setString(1, null);
cs.setString(2, "P0975");
cs.setString(3, "PRO00000000000AA");
cs.setString(4, "CHANNELTYPE_G");
cs.setString(5, "PREMIUMMODE_Y");
cs.setString(6, "C042525");
cs.setDouble(7, 45);
cs.setInt(8, 1);
cs.setString(9, null);
cs.registerOutParameter(10, OracleTypes.VARCHAR);
cs.registerOutParameter(11, Types.VARCHAR);
cs.registerOutParameter(12, Types.FLOAT);
cs.registerOutParameter(13, Types.FLOAT);
cs.execute();
return new Object[] { cs.getString(10),
cs.getString(11), cs.getDouble(12),
cs.getDouble(13) };
}
});
System.out.println(obj[1]);
return obj;
}