Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old July 14th, 2009, 09:36 AM
Friend of Wrox
Join Date: Jul 2003
Posts: 121
Thanks: 1
Thanked 0 Times in 0 Posts
Default 'Unspecified error' on ExecuteNonQuery function in ORACLE


I am trying to execute the function in ORACLE database from my .NET code, but I am getting this 'Unspecified error' error message by some reason. This is my function in the database:
create or replace FUNCTION eqn( a NUMBER, b NUMBER ) RETURN NUMBER AS
    IF a = b THEN
       RETURN -1;
       RETURN 0;
    END IF;
And this is the function in my .NET code which is trying to execute this function:
To simplefy the code, I've entered rendom values into the code
public object ExecuteFunctionTwoParameters()
OleDbCommand oracleCommand;
string stringReturn = null;
string param1_Name = "a";
string param2_Name = "b";
oracleCommand = newOleDbCommand();
oracleCommand.Connection = currentOLEDBConnection;
oracleCommand.CommandText = "EQN";
oracleCommand.CommandType = CommandType.StoredProcedure;
oracleCommand.Parameters.AddWithValue(param1_Name, 1);
oracleCommand.Parameters.AddWithValue(param2_Name, 2);
OleDbParameter retval = newOleDbParameter("return_value", OleDbType.Numeric);
retval.Direction = ParameterDirection.ReturnValue;
sErrorMessage = "";
stringReturn = oracleCommand.Parameters["return_value"].Value.ToString();
return (object)stringReturn;
} //End trycatch (System.Data.OleDb.OleDbException e)
sErrorMessage = e.Message;
stringReturn = "ERROR";
return (object)stringReturn;
//do the clean up:oracleCommand.Dispose();
oracleCommand = null;
What am I doing wrong?
Could you help me with this problem, please?
Thanks in advance,
Old July 16th, 2009, 09:37 AM
Friend of Wrox
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi

I'm not an expert on Oracle, but you are calling a function like it was a Store Procedure??

can you really do that??


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
================================================== =========
I know that CVS was evil, and now i got the
================================================== =========
Old July 16th, 2009, 09:56 AM
Friend of Wrox
Join Date: Jul 2003
Posts: 121
Thanks: 1
Thanked 0 Times in 0 Posts

I have found the source of my error. The procedure name was not explicitly pointed to the correct database schema.
It was like:
oracleCommand.CommandText = "EQN";

It supposes to be like:
oracleCommand.CommandText = "SCHEMA_NAME.EQN"

Thanks anyway for the reply.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Unspecified error mahesh_82 ADO.NET 1 January 10th, 2007 06:24 AM
Unspecified Error. lam_lvl ADO.NET 4 December 22nd, 2006 02:47 PM
Unspecified Error??? werD420 Classic ASP Databases 2 April 10th, 2005 01:00 PM
unspecified error Meterman Classic ASP Databases 1 July 13th, 2004 10:19 AM
Error trying to call Oracle function in VB.NET lou_1 Pro VB.NET 2002/2003 0 January 13th, 2004 06:42 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.