"Value does not fall within the expected range" when passing UDT to the stored procedure — oracle-tech

    Forum Stats

  • 3,716,133 Users
  • 2,242,960 Discussions


Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

"Value does not fall within the expected range" when passing UDT to the stored procedure

JWu Member Posts: 8 Red Ribbon

Here's my class mapping to the UDT (really simple):


public class Shape : IOracleCustomType, IOracleCustomTypeFactory



     public Int32 Sides { get; set; }

     public string UdtTypeName




               Attribute attr = Attribute.GetCustomAttribute(this.GetType()

                                        , typeof(OracleCustomTypeMappingAttribute));

               return (attr != null) ?






     public void FromCustomObject(OracleConnection con, IntPtr pUdt)


          OracleUdt.SetValue(con, pUdt, "SIDES", Sides);


     public void ToCustomObject(OracleConnection con, IntPtr pUdt)


          Sides = (int)OracleUdt.GetValue(con, pUdt,"SIDES");


     public IOracleCustomType CreateObject()


          return new Shape();



To call the stored procedure:

     if (Command.Connection.State == ConnectionState.Closed)




     // setting up the parameter

     OracleParameter param = new OracleParameter();

     param.Direction = ParameterDirection.Input;

     param.UdtTypeName = udt.UdtTypeName;

     param.DbType = DbType.Object;

     param.OracleDbType = OracleDbType.Object;

     param.Value = udt;

     Command.CommandText = "PORTAL_OPS.PROC_CREATE_SHAPE";

     Command.CommandType = CommandType.StoredProcedure;



A couple of points:

  • Oracle's documentation says to use  OracleCustomTypeMappingAttribute, but I notice a lot of people use OracleCustomTypeMapping.  Which one is the correct one to use?
  • While I was troubleshooting, I purposely misspelled the the value inside the OracleObjectMapping...and it didn't seem to affect anything...still getting the "Value does not fail within the expected range"?

The stacktrace stopps at

OracleCustomTypeMappingAttribute.ctor(String udtTypeName)   (I am sure the UDT type name is correct)

Help!  Thanks!

Sign In or Register to comment.