使用Java程序创建Oracle Cursor [英] Creating Oracle Cursor using Java Program

查看:139
本文介绍了使用Java程序创建Oracle Cursor的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想借助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 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.

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 CURSORs 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 the REF 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屋!

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