Hi all,
I try to use the ODP.NET OracleBulkInsert method to insert data into a table.
I create the table like this:
CREATE TABLE "DestinationSimple"
(
"Col1" INT NOT NULL,
"Col2" VARCHAR2(100) NULL
)
The C# code which uses the OracleBulkCopy class and a DataTable to insert the data looks like this:
using (OracleBulkCopy bulkCopy = new OracleBulkCopy(DbConnection))
{
bulkCopy.BulkCopyTimeout = 0;
bulkCopy.DestinationTableName = "DestinationSimple";
DataTable dt = new DataTable("DestinationSimple");
dt.Columns.Add("Col1");
dt.Columns.Add("Col2");
var r = dt.NewRow();
r["Col1"] = 1;
r["Col2"] = "Test";
dt.Rows.Add(r);
bulkCopy.WriteToServer(dt);
}
This will result in the exception message: Oracle.ManagedDataAccess.Client.OracleException (0x80004005): ORA-02373: Error parsing insert statement for table ETLBOX."DestinationSimple". ORA-00904: "COL2": invalid identifier
I am using Oracle.ManagedDataAccess.Core (2.19.101)
When I use upper-case columns names, the code will work without throwing an exception.
I also tried to use columnnames with quotes: dt.Columns.Add("\"Col1\"");
But without success.
To me it looks like a bug - seems to me that the OracleBulkCopy does not support case-sensisitive column names.
I would appreciate any help with this!