Search code examples
c#oracle-databaseuser-defined-types

How to declare out parameter in c# for T_NARRAY output in Oracle?


While execute I am getting a data type binding error. The Oracle script is returning T_Narray OUT_PUT, Which I don't know how to handle it on c# out parameter.

dbManager.AddOutputParameters(1, "P_RESULT_ARRAY", "", OracleDbType.Raw, 100);

How to do ?

My Proc:

 PROCEDURE D_ARRAY
  (
    P_SOURCE               IN NVARCHAR2,
    P_RESULT_ARRAY         OUT T_NARRAY,
    P_RESULT_STATUS        OUT NVARCHAR2,
    P_RESULT_STATUS_TEXT   OUT NVARCHAR2 
  )

Solution

  • T_NARRAY is a user-defined type. That is, it is an object defined in the database. You need to define a custom type in C# which matches the database definition. Find out more.

    You can investigate the structure of the user-defined type by querying the Oracle data dictionary: ALL_TYPES and ALL_TYPE_ATTRS.