ODP.NET 18.3 Bulkinsert with Nullable Types — oracle-tech

    Forum Stats

  • 3,715,654 Users
  • 2,242,820 Discussions


Howdy, Stranger!

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

ODP.NET 18.3 Bulkinsert with Nullable Types

user10709180 Member Posts: 2
edited March 2019 in ODP.NET

I'm trying to get bulkinsert working in a .NET application.

I have a lot of string columns, a few int columns that al seem to work when my data POCO properties are of string or int.

The bulk insert fails to work when I try to insert a Nullable int (int?) as source! Which I didn't expect as the column in the table is nullable, and should be able to handle null.

Mind you, although the POCO property was int?, it had values for all rows the array I extracted from it. So it couldn't be a <null> problem.

The exception 'System.ArgumentException' (Value does not fall within the expected range) is thrown when I try to add the array to the Parameter property of the command. (So we don't even get to the database).

I'm using ODP.NET 18.3 as dataprovider. The application is written in C# 3.5.

So I have the following questions:

1) Can I use a Nullable type (int?, datetime?) in ODP.NET BulkInsert?

2) If the answer to the previous anwer is a yes, what should I take in consideration? What am I missing?


public class MyPoco


        public int? MyInt { get; set; }


The code that extracts the array of values.

                // Get the list of values (as object)

                var valueObjectList = dataEntityList

                    .Select(item => propInfo.GetValue(item))


                var parameter = command.CreateParameter();

                parameter.Direction = ParameterDirection.Input;

                parameter.IsNullable = true;

                parameter.ParameterName = ":" + propInfo.Name;

                dynamic result = null;

                if (propertyType == typeof(int?))


                    result = ConvertToTypedList<int?>(valueObjectList);

                    parameter.Value = result; <----- this gives an ArgumentException

               // More code that is unimportant.

'result' had values in it!




Sign In or Register to comment.