81,092
社区成员
发帖
与我相关
我的任务
分享
//要么你就全拼接,要么你就全绑定,虽然问题不在这里。
stmt=this.getWrappedConnection().getConnection()
.prepareCall("{call del_r_catt_jixiao_1008(?,?,?,?,?)}");
stmt.setString(1, starDate);
stmt.setString(2, endDate);
stmt.setString(3, route);
stmt.setString(4, team);
stmt.registerOutParameter(5, OracleTypes.CURSOR);
stmt.execute();
rs=(ResultSet) stmt.getObject(5);
//要么你就全拼接,要么你就全绑定,虽然问题不在这里。
stmt=this.getWrappedConnection().getConnection()
.prepareCall("{call del_r_catt_jixiao_1008('"+starDate+"','"+endDate+"','"+route+"','"+team+"',?)}")
stmt.registerOutParameter(1, OracleTypes.CURSOR);
stmt.execute();
rs=(ResultSet) stmt.getObject(1);
public Map<String,Object> getDateInfo(String starDate,String endDate,String route,String team)throws DAOException{
Map<String,Object> retMap=new HashMap<String,Object>();
CallableStatement stmt=null;
ResultSet rs = null;
try{
stmt=this.getWrappedConnection().getConnection()
.prepareCall("{call del_r_catt_jixiao_1008(date'"+starDate+"',date'"+endDate+"',?,?,?)}");
stmt.setString(1, route);
stmt.setString(2, team);
stmt.registerOutParameter(3, OracleTypes.CURSOR);
stmt.execute();
rs=(ResultSet) stmt.getObject(3);
int colunmCount = rs.getMetaData().getColumnCount();
//String[] colNameArr = new String[colunmCount];
//String[] colTypeArr = new String[colunmCount];
//获得表头
int count=0;
while (rs.next()) {
count++;
//StringBuffer sb = new StringBuffer();
List<String> list=new ArrayList<String>();
for (int i = 0; i < colunmCount; i++) {
list.add(rs.getString(i + 1));
//sb.append(rs.getString(i + 1) + " | ");
}
retMap.put(count+"", list);
//System.out.println(sb);
}
System.out.println(count+"------- Test Proc Out is ResultSet end. ");
}catch (Exception e) {
e.printStackTrace();
throw new DAOException("PerformanceMetaDao.getInfo() : Exception : " + e.getMessage(), e);
} finally {
try {
super.cleanUp();
} catch (Exception e) {
throw new DAOException(
"PerformanceMetaDao.getInfo() : Exception : fail to closeUp database resource", e);
}
}
return retMap;
}
存储过程的话就贴个头吧,存储过程是没问题的:
create or replace procedure del_r_catt_jixiao_1008 ( i_STARTTIME VARCHAR2, --开始时间
i_ENDTIME VARCHAR2, --结束时间
--i_TIMETYPE VARCHAR2, --时间类型
i_UNIT VARCHAR2, --单位
i_team VARCHAR2,
-- i_RANDOM VARCHAR2, --随机时间
IO_CURSOR IN OUT CIDA_DT.CURTYPE)