java - 如何从存储过程返回多行?

标签 java sql oracle oracle10g

 "select tableshow from alltable where branch =      
 '"+session.getAttribute("Branch")+"' and sem = 
 '"+session.getAttribute("Sem")+"'";

通过此查询,我正在获取表的名称,例如让表名称为“fifthsem”,存储在 exe 变量中

现在我需要对此变量 exe 应用查询作为表名。 我需要从该表的过程中获取全部数据并显示在jsp页面中。

使用oracle数据库

最佳答案

How to return multiple rows from the stored procedure?

您可以使用REF CURSORs将多行从存储过程返回到客户端应用程序。

Using REF CURSORs is one of the most powerful, flexible, and scalable ways to return query results from an Oracle Database to a client application.

A REF CURSOR is a PL/SQL data type whose value is the memory address of a query work area on the database. In essence, a REF CURSOR is a pointer or a handle to a result set on the database. REF CURSORs are represented through the OracleRefCursor ODP.NET class.

查看此示例:Retrieving an Oracle cursor in Java

关于java - 如何从存储过程返回多行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31958868/

相关文章:

mysql - MySQL 是否允许使用直接连接的语法?

c# - 使用本地数据库发布 Windows 窗体

oracle - 比较 Oracle XQuery (XMLQuery/XMLTable) 中的日期

java - 是什么减慢了 Hibernate/Oracle 的速度?

java - 如何解决 PermGen 内存问题

java - 设置所需的字符串长度

php - 使用 PHP 在数据库中存储用户密码的最安全方法是什么?

oracle - 下载哪一个 : JDK or JRE?

java - 处理非递减的颜色亮度序列

java - 如何打印 mahout lda cvb 主题