gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-30 03:18:23 24 4
gpt4 key购买 nike

 "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/

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