使用Java程序创建Oracle Cursor [英] Creating Oracle Cursor using Java Program
问题描述
我想借助Java Code创建Oracle Cursor.我尝试在Internet上搜索,但没有找到任何东西.我们可以使用Java代码创建Cursor吗?
I wanted to create Oracle Cursor with the help of Java Code. I tried searching on the Internet but I didn't find anything. Can we create Cursor using Java code?
推荐答案
您不能使用Java代码创建游标.
You cannot create a cursor using Java code.
游标是对数据库内部表示查询和相应结果集的数据结构的引用(指针)-在数据库外部创建指针将毫无意义.
A cursor is a reference (pointer) to a data structure internal to the database representing a query and a corresponding set of results - creating the pointer outside of the database would be meaningless.
从 Oracle文档:
简介
REF CURSOR
s使用
REF CURSOR
是将查询结果从Oracle数据库返回到客户端应用程序的最强大,灵活和可扩展的方法之一.
Introduction to
REF CURSOR
sUsing
REF CURSOR
s is one of the most powerful, flexible, and scalable ways to return query results from an Oracle Database to a client application.
REF CURSOR
是PL/SQL数据类型,其值是数据库上查询工作区的内存地址.本质上,REF CURSOR
是数据库上结果集的指针或句柄. REF CURSOR
通过OracleRefCursor
ODP.NET类表示.
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 CURSOR
s are represented through the OracleRefCursor
ODP.NET class.
REF CURSOR
具有以下特征:
-
A
REF CURSOR
引用数据库上的内存地址.因此,客户端必须在REF CURSOR
的生存期内连接到数据库才能访问它.
A
REF CURSOR
refers to a memory address on the database. Therefore, the client must be connected to the database during the lifetime of theREF CURSOR
in order to access it.
A REF CURSOR
涉及其他数据库往返.当REF CURSOR
返回给客户端时,直到客户端打开REF CURSOR
并请求数据后,才返回实际数据.请注意,只有在用户尝试读取数据时,才可以检索数据.
A REF CURSOR
involves an additional database round-trip. While the REF CURSOR
is returned to the client, the actual data is not returned until the client opens the REF CURSOR
and requests the data. Note that data is not be retrieved until the user attempts to read it.
A REF CURSOR
不可更新. REF CURSOR
表示的结果集是只读的.您不能使用REF CURSOR
更新数据库.
A REF CURSOR
is not updatable. The result set represented by the REF CURSOR
is read-only. You cannot update the database by using a REF CURSOR
.
A REF CURSOR
不可向后滚动. REF CURSOR
表示的数据以仅向前的串行方式访问.您不能将记录指针放置在REF CURSOR
内以指向结果集中的随机记录.
A REF CURSOR
is not backward scrollable. The data represented by the REF CURSOR
is accessed in a forward-only, serial manner. You cannot position a record pointer inside the REF CURSOR
to point to random records in the result set.
A REF CURSOR
是PL/SQL数据类型.您在PL/SQL代码块内创建并返回REF CURSOR
.
A REF CURSOR
is a PL/SQL data type. You create and return a REF CURSOR
inside a PL/SQL code block.
您需要在数据库中创建一个存储过程(或函数),该存储过程将返回游标,然后从外部应用程序中调用该游标.
You need to create a stored procedure (or function) in the database that returns a cursor and then invoke that from your external application.
这篇关于使用Java程序创建Oracle Cursor的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!