C#学习教程:从C#中将表类型对象作为输入参数传递给Oracle中的存储过程如何从C#代码传递对象?创建或替换TYPECUSTOM_TYPEASOBJECT(attribute1VARCHAR(10),attribute2VARCHAR(10));创建或替换TYPECUSTOM_TYPE_ARRAYASTABLEOFCUSTOM_TYPE;PROCEDURESP_TEST(P_TABLE_ININCUSTOM_TYPE_ARRAY,P_RESULT_OUTOUTSYS_REFCURSOR)ASBEGINOPENP_RESULT_OUTFORSELECTti.attribute1,ti.attribute2,ti.attribute3FROMTABLE(P_TABLE_IN)eainnerjoinMYTABLEtionea.attribute1=ti.attribute1andea.attribute2=ti.attribute2;结束SP_TEST;并尝试添加以下参数:varoracleParam=newOracleParameter();oracleParam.OracleDbType=OracleDbType.Array;oracleParam.Direction=ParameterDirection.Input;oracleParam.ParameterName="P_TABLE_IN";oracleParam.Value=实体;oracleCommand.Parameters.Add(oracleParam);其中实体是自定义实体集合实例(定义了oracle属性映射);放;}}我按照本指南正确定义了.net实体,但仍然没有运气通过我的列表:HResult=-2146233079Message='EntityUdt::attribute1::OracleObjectMappingAttribute'cannotbesetto'attribute1Invalidvaluefor'Source=Oracle.DataAccessStackTrace:在Oracle.DataAccess.Types.OracleUdtDescriptor.DescribeCustomType(ObjectcustomTypeFactory)我花了几个小时试图找出问题,结果发现oracle属性定义的映射应该有一个不同的名称所以我只设置了所有映射属性为大写,现在可以使用了!以上就是C#学习教程:C#将表类型对象作为输入参数传递给Oracle中的存储过程。如果对大家有用,需要详细了解C#学习教程,希望大家多多关注——[OracleObjectMappingAttribute("ATTRIBUTE1")]publicstringattribute1{get;放;}[OracleObjectMappingAttribute("ATTRIBUTE2")]publicstringattribute2{get;放;会员删除。如需转载请注明出处:
