I get an ORA-00936: missing expression error when using the following code to return a single date from an Oracle table.
I've used an example snippet of code to help me put this method together and I want to assign the date to a text box in an ASP.NET page, but can't understand what to try next and how the error is being thrown.
I've debugged the application and the 'file' parameter always has a value when I do so. The error is thrown at the return statement.
Any guidance appreciated!
- public DateTime GetEffectiveDate(string file)
-
{
-
string fileNo = string.Format("'{0}'", file);
-
getDBConnection();
-
-
OracleCommand command = conn.CreateCommand();
-
command.CommandType = CommandType.Text;
-
command.CommandText = @"SELECT effectivedate
-
FROM tblcorporateactions WHERE corporateactionnumber = @fileNo";
-
-
// Input parameter
-
OracleParameter prm1 = new OracleParameter("@fileNo", OracleDbType.Varchar2);
-
prm1.Direction = ParameterDirection.Input;
-
prm1.Value = file;
-
// return parameter
-
OracleParameter ret =
-
new OracleParameter("@effectiveDate", OracleDbType.Varchar2);
-
ret.Direction = ParameterDirection.ReturnValue;
-
-
command.Prepare();
-
return (DateTime) command.ExecuteScalar(); // throws error here
-
}