Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ODP.net - DAAB - ORA-00911

644826Jun 12 2008 — edited Jun 16 2008
Hi,

I am currently using the DAAB with the Oracle.DataAccess dll (ODP for .Net), and am having problems when calling a stored procedure from with DAAB.

The stored procedure is very simple (just 4 parameters); which I can call in the standard way (see below):


OracleConnection con;
OracleCommand cmd = null;
con = new OracleConnection();
con.ConnectionString = "Data Source=testsource;User Id=testuid;Password=testpwd;";
cmd = new OracleCommand();
cmd.Connection = con;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "test";
cmd.Parameters.Add("id", OracleDbType.Int16);
cmd.Parameters[0].Direction = ParameterDirection.Input;
cmd.Parameters[0].Value = "0";
cmd.Parameters.Add("fname", OracleDbType.Varchar2, 20);
cmd.Parameters[1].Direction = ParameterDirection.Input;
cmd.Parameters[1].Value = "";
cmd.Parameters.Add("sname", OracleDbType.Varchar2, 20);
cmd.Parameters[2].Direction = ParameterDirection.Input;
cmd.Parameters[2].Value = "";
cmd.Parameters.Add("description", OracleDbType.Varchar2, 200);
cmd.Parameters[3].Direction = ParameterDirection.Input;
cmd.Parameters[3].Value = "";
OracleDataAdapter da = new OracleDataAdapter(cmd);
DataSet DS = new DataSet();
da.Fill(DS);


This works fine, but when I try to implement this within the DAAB (see below), I keep getting an error message back saying :

System.Data.OracleClient.OracleException : ORA-00911: invalid character
%SQL-F-BAD_TOKEN, => is not a valid SQL language element

Which I belive means that the symbol '=>' is somehow being passed though.

The DAAB implementation of the call is:


Database db = DatabaseFactory.CreateDatabase("testsource");
string sqlCommand = "test";
System.Data.Common.DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
db.AddInParameter(dbCommand, "id", DbType.Int16, "0");
db.AddInParameter(dbCommand, "fname", DbType.String, "");
db.AddInParameter(dbCommand, "sname", DbType.String, "");
db.AddInParameter(dbCommand, "description", DbType.String, "");
DataSet productDataSet = db.ExecuteDataSet(dbCommand);


I can succesfully retrieve tables from the database using the DAAB, but cannot call a stored procedure with parameters.

Additionally I have tried the same code (DAAB implementation) for calling a SQL Server stored procedure and it works fine, it is just with RDB via this provider (ODP);

From what I can see the manual way (non DAAB) works because it is specifying specific oracle command parameters, but surely this is the point of the DAAB, i.e. to make the code generic so that any provider will work?


Any pointer would be greatly appreciated.


Simon
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 14 2008
Added on Jun 12 2008
3 comments
3,840 views