读书人

oracle存储过程怎样返回查询出来的数据

发布时间: 2013-03-26 21:09:14 作者: rapoo

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.myexception.cn/oracle-develop/177537.html

读书人网 >J2EE开发

热点推荐