Bulk insert/update
Posted: Mon 09 Nov 2009 21:40
I am new to dotConnect and have downloaded a trial version to test it out to see if it fits our needs. We are looking at dotConnect for Oracle.
What is the best way to do a bulk insert or update? Do we have to write a PL/SQL package to do that or is there another way. There is a way to do this with ORacle dataaccess dll by setting the insert statement as the command text of the command object and passing the insert values as arrays.
When I try something similar with dotConnect, it does not seem to work. I get a ORA-01484: arrays can only be bound to PL/SQL statements.
Here is what I am trying to do:
Dim arCompID() As String = {"T1", "T2", "T3"}
Dim arDesc() As String = {"Test1", "Test2", "Test3"}
Dim prmComp As New OracleParameter
prmComp.OracleDbType = OracleDbType.VarChar
prmComp.ParameterName = "p1"
prmComp.Value = arCompID
Dim prmDesc As New OracleParameter
prmDesc.OracleDbType = OracleDbType.VarChar
prmDesc.ParameterName = "p2"
prmDesc.Value = arDesc
cmd.Parameters.Add(prmComp)
cmd.Parameters.Add(prmDesc)
cmd.CommandType = CommandType.Text
cmd.CommandText = "Insert into F21.fadm_company (company_id, description) values (:p1, :p2)"
cmd.ExecuteNonQuery()
Any help is appreciated. We are trying to use dotConnect in the direct mode and not use Oracle client.
Thanks,
What is the best way to do a bulk insert or update? Do we have to write a PL/SQL package to do that or is there another way. There is a way to do this with ORacle dataaccess dll by setting the insert statement as the command text of the command object and passing the insert values as arrays.
When I try something similar with dotConnect, it does not seem to work. I get a ORA-01484: arrays can only be bound to PL/SQL statements.
Here is what I am trying to do:
Dim arCompID() As String = {"T1", "T2", "T3"}
Dim arDesc() As String = {"Test1", "Test2", "Test3"}
Dim prmComp As New OracleParameter
prmComp.OracleDbType = OracleDbType.VarChar
prmComp.ParameterName = "p1"
prmComp.Value = arCompID
Dim prmDesc As New OracleParameter
prmDesc.OracleDbType = OracleDbType.VarChar
prmDesc.ParameterName = "p2"
prmDesc.Value = arDesc
cmd.Parameters.Add(prmComp)
cmd.Parameters.Add(prmDesc)
cmd.CommandType = CommandType.Text
cmd.CommandText = "Insert into F21.fadm_company (company_id, description) values (:p1, :p2)"
cmd.ExecuteNonQuery()
Any help is appreciated. We are trying to use dotConnect in the direct mode and not use Oracle client.
Thanks,