title: OracleCommand Parameter Varchar2 paradoxon ;-)
body: <p>i have an OracleDB with entries:</p>
  
  <p>1, test, test<br>
  2, test, test</p>
  
  <p>Id NUMBER(8,0)<br>
  Firstname (CHAR(30 BYTE))<br>
  Secondname CHAR(30 BYTE)</p>
  
  <p>And now i have this lines of code to select this entries:</p>
  
  <pre><code>string query = @"SELECT ID,FIRSTNAME,LASTNAME FROM persdata 
                   WHERE (FIRSTNAME = 'test')";
  var command = new OracleCommand(query, dbConnection) 
                { CommandType = CommandType.Text, BindByName = true };
  
  IDataReader reader = command.ExecuteReader();
  while (reader.Read())
  {
      int someColumn = reader.GetInt32(reader.GetOrdinal("ID"));
      string anotherColumn = reader.GetString(reader.GetOrdinal("VORNAME"));
      string thirdColumn = reader.GetString(reader.GetOrdinal("NACHNAME"));
      Console.WriteLine(
          String.Format("{0}: {1}, {2}", someColumn, anotherColumn, thirdColumn)
      );
  }
  </code></pre>
  
  <p>This Works fine but if i´m using parameters like:</p>
  
  <pre><code>string query = @"SELECT ID,FIRSTNAME,LASTNAME FROM persdata 
                   WHERE (FIRSTNAME = :param)";
  var command = new OracleCommand(query, dbConnection) 
                { CommandType = CommandType.Text, BindByName = true };
  
  command.Parameters.Add(":param", OracleDbType.Varchar2).Value = "test";
  
  IDataReader reader = command.ExecuteReader();
  while (reader.Read())
  {
      int someColumn = reader.GetInt32(reader.GetOrdinal("ID"));
      string anotherColumn = reader.GetString(reader.GetOrdinal("FIRSTNAME"));
      string thirdColumn = reader.GetString(reader.GetOrdinal("LASTNAME"));
      Console.WriteLine(
          String.Format("{0}: {1}, {2}", someColumn, anotherColumn, thirdColumn)
      );
  }
  </code></pre>
  
  <p>I don´t get anything! BUT if i set the ParameterValue like:</p>
  
  <pre><code>command.Parameters.Add(":param", OracleDbType.Varchar2).Value = "test                          ";
  </code></pre>
  
  <p>I get this entries o.O
  Is that the usal way, that i have to fill the parameters? But why the direct way doesn´t need it?</p>
  
  <p>So is the right way to get the Column size and fill the parameter value?
  or am I doing it wrong?</p>
  
  <p>Thanks :-)</p>