title: Second insert fails because of returning into output parameter (OracleParameter)
body: <p>I am trying to insert two rows into a table (sequentiel). The first insert command is executed without any trouble. The second insert command gets stuck in the <code>ExecuteNonQuery()</code> part. When I remove the returning part (<code>OracleParameter</code> with <code>Direction = Output</code>) both inserts are successful.</p>
  
  <p>Doesn't work (executed twice in a sequence with different data each):</p>
  
  <p><code>cmd.CommandText = "INSERT INTO table (Col1, Col2, Col3,...) VALUES (:ParamCol1, :ParamCol2, :ParamCol3,...) RETURNING ROWIDTOCHAR(ROWID) INTO :OutputROWID";</code> </p>
  
  <p>Works:</p>
  
  <p><code>cmd.CommandText = "INSERT INTO table (Col1, Col2, Col3,...) VALUES (:ParamCol1, :ParamCol2, :ParamCol3,...)";</code></p>
  
  <p>The output-parameter is declared and initialized like the following:</p>
  
  <p><code>OracleParameter outputRowId = new OracleParameter(":OutputROWID", OracleDbType.Varchar2, 30) { Direction = ParameterDirection.Output })</code></p>
  
  <p>Reference: <a href="http://docs.oracle.com/html/B28089_01/OracleParameterClass.htm#i1012062" rel="nofollow">OracleParameter</a></p>
  
  <p>The funny thing is, it also works when I use the first method (with the returning <code>ROWID</code>), but only when I rename the parameter in the second insert to i.e. <code>:OutputROWID2</code>.</p>
  
  <p>Any ideas on that why the execution gets stuck and how I can solve this?</p>
  
  <p>EDIT:</p>
  
  <p>Here the longer Code-Snippet:</p>
  
  <pre><code>using (OracleTransaction transaction = Globals.Db.Connection.BeginTransaction())
              {
  
                  using (OracleCommand cmd = Globals.Db.Connection.CreateCommand())
                  {
                      cmd.BindByName = true;
                      cmd.CommandText = "INSERT INTO table (Col1, Col2, Col3,...) VALUES (:ParamCol1, :ParamCol2, :ParamCol3,...) RETURNING ROWIDTOCHAR(ROWID) INTO :OutputROWID";
  
                      OracleParameter outputRowId = new OracleParameter(":OutputROWID", OracleDbType.Varchar2, 30) { Direction = ParameterDirection.Output };
  
  
                      cmd.Parameters.Add(paramCol1, data["Col1"]);
                      cmd.Parameters.Add(paramCol2, data["Col2"]);
                      cmd.Parameters.Add(paramCol3, data["Col3"]);
                      ...
                      cmd.Parameters.Add(outputRowId);
  
                      try
                      {
                          cmd.ExecuteNonQuery();
                          transaction.Commit();
                      }
                      catch (Exception ex)
                      {
                          return;
                      }
                  }
              }
  </code></pre>