I have a line of code that throws
Oracle Exception - ORA-00911: Invalid Character
when trying to execute the following C # code:
double tempDateTimeObj = Convert.ToDouble(someClass.GetTime(tempObjID, objStartTime, todayTime).Rows[0][0]);
GetTime is a function that executes an SQL call that takes the variables you see above, and the SQL call displays the Oracle number type, and then the C # GetTime function returns a DataTableCollection Tables object from one row each time.
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 <connection object>.getDS(sql).Tables[0]; }
If I am debugging, take the sql string with the values ββfor the variables and drop it into Oracle SQL Developer, it works fine and returns the number in the SQL Dev console. However, when I debug and run into this line, C # code throws an exception 00911. Since the sql line was tested in Oracle SQL Dev, the syntax must be valid. Given valid syntax, why does VS2010 throw this error / exception?
EDIT: Here is an example of a line that is built in C # and sent to the database:
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
The existence of a half-column and the absence of a half-column in a C # line was tested and led to the same Oracle exception, despite the fact that they work in Oracle SQL Dev