When doing a Dapper Execute
on an Oracle table with a CLOB
data field and that value is over 1,900 characters I get this error:
System.ArgumentOutOfRangeException: Specified argument was out of the
range of valid values. at
Oracle.ManagedDataAccess.Client.OracleParameter.set_Size(Int32 value)
at ParamInfo329f2fa4-aac3-423e-9f1b-680b19fd8dea(IDbCommand , Object )
at Dapper.CommandDefinition.SetupCommand(IDbConnection cnn, Action2 paramReader) in /_/Dapper/CommandDefinition.cs:line 144 at Dapper.SqlMapper.TrySetupAsyncCommand(CommandDefinition command, IDbConnection cnn, Action
2 paramReader) in
//Dapper/SqlMapper.Async.cs:line 412 at
Dapper.SqlMapper.ExecuteImplAsync(IDbConnection cnn, CommandDefinition
command, Object param) in //Dapper/SqlMapper.Async.cs:line 658
Doing some research it appears that I need to use OracleDynamicParameters
however this is a massive issue for me. As it would require a major rewrite for Insert commands over 50+ tables. Is there a way to get it to work for Execute
?
Here is my code:
var ct = CommandType.Text;
using var connect = new OracleConnection(conString);
var results = connect.Execute(query, model, commandType: ct);
connect.Close();
This is the model:
public class MyModel
{
public string Field1 { get; set; }
public string Field2 { get; set; }
public string ClobData { get; set; }
}
Note: If I take the insert and manually create a SQL statement in a query program the longer the 1,900 works.