如何设置存储过程返回的游标的获取大小。请找到我的以下代码片段:
conn.setAutoCommit(false);
cstmt = (CallableStatement) conn.createStatement();
cstmt = conn.prepareCall(sqlQuery);
cstmt.execute();
rst = (ResultSet) cstmt.getObject(sqlQuery);
rst.setFetchSize(100);
但是结果集似乎忽略了setFetchSize。有人可以建议我解决方案吗?另外我的oracle版本是ojdbc11.2.0
最佳答案
您需要将autocommit
设置为false,
conObj.setAutoCommit(false);
并加载callable
语句,CallableStatement cstmt = connObj.createStatement();
来自文档,
In the case of statements returning a ResultSet, the statement completes when the last row of the ResultSet has been retrieved or when the ResultSet has been closed. In more complex cases, a single statement can return multiple results as well as output parameter values. Here, the COMMIT occurs when all results and output parameter values have been retrieved.
关于java - 如何在游标上设置FetchSize,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26777992/