怎样在java中接收存储过程返回的游标参数!急 如题,谢谢! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 OracleType.Cursorhttp://java.chinaitlab.com/JDBCJDO/38254.html 游标返回的就用resultset就可以了。例如CallableStatement cs = null; cs = conn.prepareCall(sql); cs.setInt(1,oneParamIn); cs.setInt(2, twoParamIn); cs.registerOutParameter(3,oracle.jdbc.OracleTypes.CURSOR); cs.execute(); rs = (ResultSet)cs.getObject(3); ICallableStatement cs = null; ResultSet rs = null; try { cs = DbFactory.getInstance().getCallableStatement("CARTOON", "{ call getCost(?,?,?)}"); cs.setString(1, "select count(*) from test"); cs.setBigDecimal(2, new BigDecimal("0")); cs.registerOutParameter(3, OracleTypes.CURSOR); cs.executeQuery(); rs = (ResultSet) cs.getObject(3); while (rs.next()) { System.out.println(rs.getString("SOC")); } } catch (Exception e) { throw new EipException(e); } finally { try { if (rs != null) { rs.close(); } if (cs != null) { cs.close(); } } catch (SQLException e) { throw new EipException(e); } } SQL--(查询语句)mysql数据库oracle也可以 下面这个存储过程怎么错误了啊? 着急!! 给一个Oracle 9i 的下载地址 oracle rman备份问题 讨论:分组查询的问题 请教ORA:08103错误de解决方法! 能否将存储过程转移到另外的机器上去? 新手求解:定时备份作业问题,请! 高手请进:可不可以在程序中定义一个函数再传到Oracle服务器,并返回值取得结果? 通过sql developer将sql server数据库迁移到Oracle失效 麻烦高手们给解释这条sql语句的意思 谢谢 存储过程编译时的pls-00103错误
CallableStatement cs = null;
cs = conn.prepareCall(sql);
cs.setInt(1,oneParamIn);
cs.setInt(2, twoParamIn);
cs.registerOutParameter(3,oracle.jdbc.OracleTypes.CURSOR);
cs.execute();
rs = (ResultSet)cs.getObject(3);
ResultSet rs = null;
try {
cs = DbFactory.getInstance().getCallableStatement("CARTOON",
"{ call getCost(?,?,?)}");
cs.setString(1, "select count(*) from test");
cs.setBigDecimal(2, new BigDecimal("0"));
cs.registerOutParameter(3, OracleTypes.CURSOR);
cs.executeQuery();
rs = (ResultSet) cs.getObject(3);
while (rs.next()) {
System.out.println(rs.getString("SOC"));
}
} catch (Exception e) {
throw new EipException(e);
} finally {
try {
if (rs != null) {
rs.close();
}
if (cs != null) {
cs.close();
}
} catch (SQLException e) {
throw new EipException(e);
}
}