gpt4 book ai didi

java - 引用游标和结果集

转载 作者:塔克拉玛干 更新时间:2023-11-01 22:01:11 27 4
gpt4 key购买 nike

我正在从我的 java 类中调用一个存储过程,它返回一个 ref 游标,我正在从游标中提取结果集并迭代结果集以供我使用,现在我的问题是这个

返回的 ref 游标是否包含所有数据,或者当在游标上为结果集调用 getObject 时它再次转到数据库服务器?

问候

最佳答案

Fetch Size是您要查找的 Oracle 参数。如果您的应用程序涉及将数据从服务器传输到客户端,这是一个非常重要的设置。

您可以使用此方法设置语句的提取大小。

void setFetchSize(int rows) throws SQLException

http://download.oracle.com/docs/cd/B28359_01/java.111/b31224/resltset.htm#sthref1000

从上面的链接...

By default, when Oracle JDBC executes a query, it receives the result set 10 rows at a time from the database cursor. This is the default Oracle row-prefetch value. You can change the number of rows retrieved with each trip to the database cursor by changing the row-prefetch value (see "Oracle Row Prefetching" for more information).

When the statement object executes a query, the fetch size of the statement object is passed to the result set object produced by the query. However, you can also set the fetch size in the result set object to override the statement fetch size that was passed to it.

关于java - 引用游标和结果集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6669327/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com