473,320 Members | 2,097 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Oracle error returning value from database

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!

Expand|Select|Wrap|Line Numbers
  1. public DateTime GetEffectiveDate(string file) 
  2.         {
  3.             string fileNo = string.Format("'{0}'", file);
  4.             getDBConnection();
  5.  
  6.             OracleCommand command = conn.CreateCommand();
  7.             command.CommandType = CommandType.Text;
  8.             command.CommandText = @"SELECT effectivedate 
  9.                 FROM tblcorporateactions WHERE corporateactionnumber = @fileNo";
  10.  
  11.             // Input parameter
  12.             OracleParameter prm1 = new OracleParameter("@fileNo", OracleDbType.Varchar2);
  13.             prm1.Direction = ParameterDirection.Input;
  14.             prm1.Value = file;
  15.             // return parameter
  16.             OracleParameter ret =
  17.                 new OracleParameter("@effectiveDate", OracleDbType.Varchar2);
  18.             ret.Direction = ParameterDirection.ReturnValue;
  19.  
  20.             command.Prepare();
  21.             return (DateTime) command.ExecuteScalar(); // throws error here
  22.         }
Jun 3 '09 #1
1 2161
debasisdas
8,127 Expert 4TB
that simply mean there is some error in the SQL statement .
Jun 4 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: susmita_ganguly | last post by:
Hi I am trying to upgrade from oracle 8i to oracle 9i on the same server ..I don't know much abt migration . Can anyone help me out. Thanks. Susmita
0
by: JWM | last post by:
I am trying to implement Oracle connection pooling for the following code, which was written by someone else. Here is my main question -- this java file creates code that is executed every hour,...
3
by: Nathan Sokalski | last post by:
When I attempt to run a form created with Oracle9i Forms Builder I receive a dialog box asking for the following info: User Name: Password: Database: I obviously know my User Name and...
4
by: Roger Redford | last post by:
Dear Experts, I'm attempting to marry a system to an Oracle 817 datbase. Oracle is my specialty, the back end mainly, so I don't know much about java or javascript. The system uses javascript...
1
by: Andrew Arace | last post by:
I scoured the groups for some hands on code to perform the menial task of exporting table data from an Access 2000 database to Oracle database (in this case, it was oracle 8i but i'm assuming this...
0
by: ʹÃûÑï | last post by:
ORA-03114: not connected to ORACLE && MS's Bug?? DataBase:Oracle 817 using OracleClient,net framework 1.1 I'm using ADO.Net in C# with Oracle 817. and following is my public data access...
2
by: =?Utf-8?B?Vmlua2k=?= | last post by:
Hello Everyone, I can successfully insert and update the oracle database by calling a oracles stored proc from my .net code. This oracle stored proc is returning some value. I cannot see that...
1
by: =?Utf-8?B?Vmlua2k=?= | last post by:
Hello Everyone, I can successfully insert and update the oracle database by calling a oracles stored proc from my .net code. This oracle stored proc is returning some value. I cannot see that...
14
by: jehugaleahsa | last post by:
Hello: I am working with Oracle .NET Stored Procedures. I would like to know how to return the results of a SELECT statement. I have tried returning a OracleRefCursor and a DataTable, but...
5
by: Martin Solveig | last post by:
Hello, SLES9 SP1 is on PIII with two 800MHz procesors and 2GB RAM, on four SATA 156GBhard disks are created two RAID1 arays, on one RAID is OS with 1GB swap and Oracle 10.1.0.4 enterprise edition,...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.