使用用户定义的类型参数调用函数(Oracle ODP.NET) [英] Calling a function with user defined type parameters (Oracle ODP.NET)
问题描述
我使用的是一个函数:
pre $ fu $ has_permissions(udt_person('johny','superman'),'fly_away' )
udt_person是用户定义的类型:
创建或替换TYPE udt_person AS OBJECT
(name VARCHAR2(3),
id VARCHAR2(18));
我想使用绑定变量whan调用这个函数,但我不确定我是什么做错了......这里是代码:
......
OracleParameter udtPersParam = new OracleParameter() ;
udtPersParam.ParameterName =:pUdtPers;
udtPersParam.UdtTypeName =UDT_PERS;
string [] paramValues = {name,id};
udtPersParam.Value = paramValues;
OracleParameter pAction = new OracleParameter(:pAction,OracleDbType.Varchar2,255);
pAction.Value = action;
parameters.Add(udtPartParam);
parameters.Add(pAction);
$ b $ try
{
_loginOdr = DBFacade.ExecuteSelectQuery(select fu_has_permissions(:pUdtPart,:pAction)from dual,parameters);
$ / code>
谢谢!
udt类型必须是实现
IOracleCustomType
和/或IOracleCustomTypeFactory,IOracleArrayTypeFactory
不幸的是,您不能只创建一个字符串数组并将其传入
查看odp安装附带的odp.net示例
%ora_home%\client_1 \odp.net\samples\4\UDT
也可以查看这些链接以获得样本和演练
http://developergeeks.com / article / 35 / working-with-user-defined-type-oracle-udt-and-custom-type-using-odp-net-11g
http://www.codeproject.com/ KB / database / ORACLE_UDT.aspx
和
HTTP://st-curriculum.or acle.com/obe/db/hol08/dotnet/udt/udt_otn.htm
I'm using a function :
fu_has_permissions(udt_person('johny','superman'),'fly_away')
udt_person is a user defined type :
create or replace TYPE udt_person AS OBJECT
(name VARCHAR2(3),
id VARCHAR2(18));
I want to use bind variables whan calling this function, but i'm not really sure what am i doing wrong ... Here's the code :
......
OracleParameter udtPersParam = new OracleParameter();
udtPersParam.ParameterName = ":pUdtPers";
udtPersParam.UdtTypeName = "UDT_PERS";
string[] paramValues = { name, id };
udtPersParam.Value = paramValues;
OracleParameter pAction = new OracleParameter(":pAction", OracleDbType.Varchar2, 255);
pAction.Value = action;
parameters.Add(udtPartParam);
parameters.Add(pAction);
try
{
_loginOdr = DBFacade.ExecuteSelectQuery("select fu_has_permissions(:pUdtPart, :pAction) from dual", parameters);
}
Thanks!
the udt type must be a class that implements IOracleCustomType and/or IOracleCustomTypeFactory, IOracleArrayTypeFactory
unfortuntately you cannot just create a string array and pass it in
look in the odp.net samples that come with the odp installation %ora_home%\client_1\odp.net\samples\4\UDT
also check out these links for samples and walkthroughs http://developergeeks.com/article/35/working-with-user-defined-type-oracle-udt-and-custom-type-using-odp-net-11g http://www.codeproject.com/KB/database/ORACLE_UDT.aspx and http://st-curriculum.oracle.com/obe/db/hol08/dotnet/udt/udt_otn.htm
这篇关于使用用户定义的类型参数调用函数(Oracle ODP.NET)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!