本文介绍了如何从executeBatch获取ResultSet?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从执行的批处理中获取结果集:

I need to get the result set from an executed batch :

    String [] queries = {"create volatile table testTable as (select * from orders) with data;", 
                         "select top 10 * from testTable;" , 
                         "drop table testTable" };
     for (String query : queries) {
        statement.addBatch(query);
    }
    statement.executeBatch();

我执行批处理如何从select查询中获取结果集?

Ones i execute batch how can i get the result set from the select query ?

推荐答案

简而言之,你不应该这样做。应该使用普通的多个execute()。

In short, you should not. Plain multiple execute() should be used.

正如根据,它不应该支持getResultSet ()/ getMoreResults()API。

As as according to the javadoc of executeBatch(), it should not support getResultSet()/getMoreResults() API.

此外,在#14.1.2

Also, in JDBC™ 4.0 Specification #14.1.2

但是有些JDBC驱动程序可能会支持,请自担风险。

But some JDBC drivers might do support, try at your own risk.

这篇关于如何从executeBatch获取ResultSet?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 23:52