I'm trying to execute multiple inserts at once like this
var mydict = new Dictionary<int, int> { { 1, 2 }, { 3, 4 } };
var query = string.Join("; ", mydict.Select(x => $"insert into myTable (colA, colB) values ({x.Key},{x.Value})"));
using(var connection = new new OracleConnection(dbConnectionString))
{
var command = connection.CreateCommand();
command.CommandText = query;
command.ExecuteNonQuery();
}
but i got Oracle.ManagedDataAccess.Client.OracleException: 'ORA-00911: invalid character'
even I can manually execute the generated query from sqldeveloper with no issues.
I alreay did this in the past with sqlserver and sqlite, and i had no issues.
why this happens? is there a cleaner way?
here is the generated sql:
insert into myTable (colA, colB) values (72520,2452); insert into myTable (colA, colB) values (73293,2453)