title: Oracle: Bulk update of records from c#
body: <p>I have a requirement where I have to perform bulk update of records in Oracle using c#. I'm trying to achieve this by passing an array of record ids that have to be updated back to oracle,but the code is not working.</p>
  
  <p>The latest code that I have used is-</p>
  
  <pre><code>List&lt;Int64&gt; listTransId = new List&lt;Int64&gt;();
  while (reader.Read())
  {
    listTransId.Add(Convert.ToInt64(reader["TOLL_TX_SEQ_NUM"]));
  }
  
  Int64[] arrTOLL_TX_SEQ_NUM = new Int64[listTransId.Count];
  arrTOLL_TX_SEQ_NUM = listTransId.ToArray();
  
  OracleTransaction txn =  connection.BeginTransaction(IsolationLevel.ReadCommitted);
  OracleCommand updateCmd = new OracleCommand(@" BEGIN UPDATE TOLL_TRANSACTION SET CCH_EXPORT_DATETIME = SYSDATE WHERE TOLL_TX_SEQ_NUM = :TOLL_TX_SEQ_NUM; END;");
  updateCmd.CommandType = CommandType.Text;
  updateCmd.Connection = connection;
  //update Cmd.BindByName = true;
  update Cmd.ArrayBindCount = arrTOLL_TX_SEQ_NUM.Length;
  
  OracleParameter TOLL_TX_SEQ_NUM = new OracleParameter("TOLL_TX_SEQ_NUM", OracleDbType.Int64);
  TOLL_TX_SEQ_NUM.Direction = ParameterDirection.Input;
  TOLL_TX_SEQ_NUM.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
  TOLL_TX_SEQ_NUM.Value = arrTOLL_TX_SEQ_NUM;
  TOLL_TX_SEQ_NUM.Size = arrTOLL_TX_SEQ_NUM.Length;
  
  updateCmd.Parameters.Add(TOLL_TX_SEQ_NUM);
  Console.WriteLine("Connection state - " + connection.State);
  updateCmd.ExecuteNonQuery();
  txn.Commit();
  
  connection.Close();
  </code></pre>