日期:2014-05-19  浏览次数:20617 次

oracle存储过程怎样返回查询出来的数据?????????
返回游标?自定义类型?还是临时表?
那java怎样获取返回的数据啊??







------解决方案--------------------
execute('存储过程名称',new CallableStatementCallback() {
public Object doInCallableStatement(CallableStatement cs)
throws SQLException, DataAccessException {
//定义过程输出参数类型
cs.registerOutParameter(1, Types.VARCHAR);
cs.registerOutParameter(2, Types.VARCHAR);
cs.execute();
//获取过程输入参数
cs.getString(1));
cs.getString(2));
return 返回你要的信息;
}
});


记着,给分哦!
------解决方案--------------------
Java code

psmt = conn.prepareCall({call pres(?,?,?)});
psmt.setInt(1,111);
psmt.setString(2,"xxxx");
psmt.registerOutParameter(3, Types.VARCHAR);
psmt.executeUpdate();

// 返回的数据
String result = psmt.getString(3);

------解决方案--------------------
http://www.blogjava.net/icewee/archive/2011/04/18/353198.html


应该能满足你的需要。
------解决方案--------------------
探讨

为什么没人啊。。

我的异常网推荐解决方案:oracle存储过程,http://www.aiyiweb.com/oracle-develop/177537.html