OracleBulkCopy Throws ORA-26093 When Inserting into NUMBER Column With Precision (Doc ID 1382276.1)

Last updated on JULY 05, 2017

Applies to:

Oracle Data Provider for .NET - Version: 11.2.0.1 and later   [Release: 11.2 and later ]
Information in this document applies to any platform.

Symptoms

Using ODP.NET and OracleBulkCopy to insert data in to a table with number column and precision fails with below error.

Error in row '1' column '1'
ORA-26093: input data column size (24) exceeds the maximum input size (22)


drop table mytest1;
Create table mytest1 (qty number(13,2));


Sample c# Application which demonstrate the issue:
=====================================


using System;
using System.Data;
using Oracle.DataAccess.Client;

namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
try
{
//create a datatable
DataTable dt = new DataTable();
DataColumn dc = new DataColumn();
dt.Columns.Add(dc);

dt.Rows.Add(Convert.ToDouble("100100100.11"));
string connStr = "Data Source=TESTTNS;User ID=scott; Password=tiger;";
using (OracleBulkCopy bc = new OracleBulkCopy(connStr, OracleBulkCopyOptions.Default))
{
bc.DestinationTableName = "MYTEST1";
bc.ColumnMappings.Add(0, "QTY");
bc.WriteToServer(dt);
}
Console.WriteLine("Done");
Console.ReadLine();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message.ToString());
Console.ReadLine();
}

}
}
}

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms