I am inserting a block of 5000 records at a time, one block right after the other. The commands are created in a seperate DLL and can call anyone of 4 different stored procedures. Is there a bulk insert method that might speed this up. Currrently it takes about 1.5 MS per record and would like to get this down to about .7 MS.
Thanks,
Dave
Shared Sub WriteCMSMessagesToDatabase(ByVal myFacility As FacilityType, ByVal Commands As List(Of System.Data.OracleClient.OracleCommand))
Dim oracleConnection As New OracleConnection
Dim _Cmd As New OracleCommand
Try
Dim aStopWatch As New Stopwatch
Using oracleConnection
aStopWatch.Start()
oracleConnection.ConnectionString = myFacility.ConnectionString
_Cmd.Connection = oracleConnection
_Cmd.CommandType = CommandType.StoredProcedure
oracleConnection.Open()
_Cmd.Transaction = oracleConnection.BeginTransaction
For Each aCmd As OracleCommand In Commands
_Cmd.CommandText = aCmd.CommandText
_Cmd.Parameters.Clear()
For Each aParam As OracleParameter In aCmd.Parameters
Dim prm As New OracleParameter
prm = CType(DirectCast(aParam, ICloneable).Clone, OracleParameter)
_Cmd.Parameters.Add(prm)
Next
_Cmd.ExecuteNonQuery()
Next
_Cmd.Transaction.Commit()
aStopWatch.Stop()
End Using
Catch ex As Exception
End Try
End Sub