title: ORA-00911: invalid character in C#, but not Oracle SQL Developer
body: <p>I have a code line that's throwing an </p>
  
  <blockquote>
    <p>Oracle Exception - ORA-00911: invalid character</p>
  </blockquote>
  
  <p>when trying the following C# code:</p>
  
  <pre><code>double tempDateTimeObj = Convert.ToDouble(someClass.GetTime(tempObjID, objStartTime, todayTime).Rows[0][0]);
  </code></pre>
  
  <p>GetTime is a function that makes an SQL call that takes in the variables you see above, and the SQL call OUTs a Oracle number type and then the GetTime C# function returns a <code>DataTableCollection Tables</code> object of one row each time.</p>
  
  <pre><code>public static DataTable GetTime(string tempObjID, DateTime objStartTime, DateTime todayTime)
  {
  
      string sql = "select some_pkg.get_time('" + tempObjID + "', to_date('" + objStartTime + "', 'mm/dd/yyyy hh:mi:ss am'), to_date('" + todayTime + "', 'mm/dd/yyyy hh:mi:ss am')) from dual;";
  
      return &lt;connection object&gt;.getDS(sql).Tables[0];
  }
  </code></pre>
  
  <p>If I debug, grab the sql string having values for the variables, and throw it into Oracle SQL Developer, it works just fine and returns a number in the SQL Dev console. However when I debug and come across that line, the C# code throws the 00911 exception. Since the string sql has been tested in Oracle SQL Dev, the syntax should be valid. Given valid syntax, why is VS2010 throwing this error/exception?</p>
  
  <p><strong>EDIT:</strong>
  Here is a sample string of what's being built in C# and sent to the DB:</p>
  
  <pre><code>select some_pkg.get_time('23569245', to_date('11/8/2012 1:21:06 PM', 'mm/dd/yyyy hh:mi:ss am'), to_date('12/31/2012 12:52:18 AM', 'mm/dd/yyyy hh:mi:ss am')) from dual
  </code></pre>
  
  <p>Having a semi-colon and not having semi-colon in the C# string have been tried and resulted in the same Oracle exception despite both working in Oracle SQL Dev</p>