使用REF光标与ODP.NET输入类型 [英] Using a ref cursor as input type with ODP.NET

查看:212
本文介绍了使用REF光标与ODP.NET输入类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用 REFCURSOR 作为Oracle存储过程的输入参数。这个想法是选择一组记录,它们喂到存储过程,然后SP遍历输入 REFCURSOR ,做一些操作,以它的记录。不,我不能选择SP里面的记录,从而避免使用 REFCURSOR 作为输入类型。

I'm trying to use a RefCursor as an input parameter on an Oracle stored procedure. The idea is to select a group of records, feed them into the stored procedure and then the SP loops over the input RefCursor, doing some operations to its records. No, I can't select the records inside the SP and thus avoid having to use the RefCursor as an input type.

我已经找到了如何做到这一点的一个例子(这这里将是链接,但似乎我不能使用它们还)Oracle的文档,但它使用一个简单的 SELECT 来填充输入 REFCURSOR ;并在其中存在困难:我已经得到了从代码中填充它。

I've found an example on how to do this on (this here would be the link, but it seems I cannot use them yet) Oracle's documentation, but it uses a simple SELECT to populate the input RefCursor; and therein lies the rub: I've got to populate it from code.

您看到的,在代码中我有这样的:

You see, in code I have this:

[OracleDataParameter("P_INPUT", OracleDbType.RefCursor, ParameterDirection.Input)]
private List<MiObject> cursor;

和,我已经试过填充的光标的有列表< T> ,一个数据表为MyObject 并没有什么作品。当我尝试运行我的测试中,我得到一个错误:

And, I've tried populating cursor with a List<T>, a DataTable, even an plain array of MyObject, and nothing works. When I try running my tests I get an error:

参数无效链接

也许没有确切的字眼,因为我是从西班牙语翻译,但是这消息

Maybe not the exact wording, as I'm translating from Spanish, but that's the message

任何想法?

推荐答案

我也是在马克·威廉姆斯,文章我试着在我的岗位环节的作者联系,他有kinly回应是这样的:

I'm also in contact with Mark Williams, the author of the article I've tried to link on my post, and he has kinly responded like this:


这是没有问题向我发送电子邮件,但是,我想我会令你失望与我在这一个答案

" It is no problem to send me email; however, I think I will disappoint you with my answer on this one.

可惜你不能做你正在尝试做的(创建像客户端一个指针)。

Unfortunately you can't do what you are trying to do (create a refcursor from the client like that).

一对夫妇的与是一个指针指在服务器上由Oracle拥有的内存和Oracle没有像一个DataTable或.NET列表等客户端项目的概念问题。

A couple of problems with that are that a refcursor refers to memory owned by Oracle on the server and Oracle has no concept of client items like a DataTable or a .NET List, etc.

你有任何其他选项比使用一个指针?

Do you have any other options available other than using a refcursor? "

所以基本上我拧其他可用的,这个问题被关闭。感谢您的阅读和/或想帮忙,大家。

So basically I'm screwed, and this question is closed. Thanks for reading and/or trying to help, you all.

这篇关于使用REF光标与ODP.NET输入类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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