TABLE OF VARCHAR2 Oracle odp.net的输出参数 [英] Output parameter for TABLE OF VARCHAR2 Oracle odp.net

查看:133
本文介绍了TABLE OF VARCHAR2 Oracle odp.net的输出参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这种类型:

TYPE tipo_TableVarchar2 IS TABLE OF VARCHAR2(1000) INDEX BY BINARY_INTEGER;

和过程get_array (p_arr out TableVarchar2 )是...

OracleParameter param = new OracleParameter();
param.OracleDbType = OracleDbType.Varchar2;
param.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
param.ParameterDirection = ParameterDirection.Output;

cm.Parameters.Add(param);

如何使用OracleParameter的输出获取值?

How to use OracleParameter's output to get the value?

推荐答案

查看Oracle 11g odp.net驱动程序,该驱动程序允许您传递Oracle类型. Oracle网站以及11g主页的安装目录中都有一些示例... C:\ Oracle \ Ora11g_Home \ odp.net \ samples \ 2.x \ UDT

Look into the Oracle 11g odp.net drivers, which allows you to pass Oracle Types. There are some samples on Oracle's site, as well as in the install directory of your 11g home... C:\Oracle\Ora11g_Home\odp.net\samples\2.x\UDT

在这个示例中,我不得不拉回一个对象类型.

I had to pull back an object type in this sample.

您将拥有类似的东西...

You'll have something like this...

        OracleParameter p_params = new OracleParameter();
        p_params.ParameterName = "params";
        p_params.OracleDbType = OracleDbType.Object;
        p_params.Direction = ParameterDirection.InputOutput;
        // Note: The UdtTypeName is case-senstive
        p_params.UdtTypeName = "SCHEMA_NAME.TYPE_NAME";

您还需要一个定义您的类型的类. 对"OracleObjectMappingAttribute"和"IOracleCustomTypeFactory"进行一些搜索.

You also need a class that defines your type. Do some searches for "OracleObjectMappingAttribute" and "IOracleCustomTypeFactory".

旁注-我正在使用11g odp.net驱动程序来访问10g数据库.您只需要在项目中引用以下dll:oci.dll,oraociicus11.dll和OraOps11w.dll.您应该已经在引用Oracle.DataAccess.dll(只需确保您开始使用11g版本即可).

Side note - I am using the 11g odp.net drivers to hit a 10g database. You just need to reference the following.dlls in your project: oci.dll, oraociicus11.dll, and OraOps11w.dll. You should already be referencing Oracle.DataAccess.dll (Just make sure you start hitting the 11g version).

这篇关于TABLE OF VARCHAR2 Oracle odp.net的输出参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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