从可调用语句中检索数据时,executeQuery()和getResultSet() [英] executeQuery() and getResultSet() when retrieving data from callable statement

查看:95
本文介绍了从可调用语句中检索数据时,executeQuery()和getResultSet()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从JDBC中没有输入和输出参数的存储过程获取结果集时,调用.execute.getResultSet.executeQuery之间是否有区别?

Is there a difference between calling .execute, .getResultSet and .executeQuery when getting the result set from a stored procedure that has no input and output parameters in JDBC?

推荐答案

execute仅返回布尔值,并且要获取结果集或更新计数,必须显式调用这些方法

execute returns just boolean value and to get result set or updates count, you have to explicitly call those methods

直接使用executeQueryexecuteUpdate时,您将跳过一个步骤(当您知道将作为SQL结果返回给您的内容时,在基本操作中很有用).

when you use executeQueryor executeUpdate directly, you're skipping one step (useful in basic operations when you know what will be returned to you as SQL result).

这篇关于从可调用语句中检索数据时,executeQuery()和getResultSet()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆