I'm getting an 'ORA-12899 - Value too large for column (actual: 5, maximum: 4)' that I can't track down. I'm doing textbook parametized insert using the Oracle.ManagedDataAccess provider in C#. Has anybody seen anything like this?
What we're doing looks like:
var commandText = "insert into MyTable ([a ton of variables]) values(:A,:B,..........)";
using (OracleConnection connection = new OracleConnection(connectionString))
{
connection.Open();
using (OracleCommand command = new OracleCommand(commandText, connection))
{
for (the ton of variables there are to insert whose values are in a collection)
command.Parameters.Add(theVariableName, theVariableValue);
}
command.ExecuteNonQuery();
}
Any thoughts? I checked a number of other answers, but with no luck.
Try setting command.BindByName=true.
The issue could be with the order with which you're adding the parameters in your for "(the tons of variables...)" loop. There is a parameter in the OracleCommand "BindByName" which defaults to false, meaning that it will ignore your variable name in the OracleParameter you're creating and just rely on the order in which you add them. So if your variables are being added out of order, you will definitely need to set command.BindByName=true.