niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Databases » Oracle
calling parameterized Oracle stored procedure in C#???
Post new topic   Reply to topic Page 1 of 1 [2 Posts] View previous topic :: View next topic
Author Message
stevedhoward@gmail.com
*nix forums Guru Wannabe


Joined: 03 Jan 2006
Posts: 173

PostPosted: Mon Jul 17, 2006 5:46 pm    Post subject: Re: calling parameterized Oracle stored procedure in C#??? Reply with quote

Check cdos for a response.
Back to top
taohuang.tamu@gmail.com
*nix forums beginner


Joined: 17 Jul 2006
Posts: 4

PostPosted: Mon Jul 17, 2006 4:52 pm    Post subject: calling parameterized Oracle stored procedure in C#??? Reply with quote

I'm trying to call a parameterized stored procedure in C# using
microsoft ODBC .NET. Could you please give me some help or hint? Thank
you very much!
C# code:
.... //connection code
odbcCommand.CommandType = CommandType.StoredProcedure;
odbcCommand.CommandText = "BEGIN myProc(?, ?); END;";
odbcCommand.CommandTimeout = 0;

OdbcParameter paramA =
odbcCommand.Parameters.Add("@A_CNT", OdbcType.Int);
paramA.Value = _a_cnt;
OdbcParameter paramB =
odbcCommand.Parameters.Add("@B_CNT", OdbcType.Int);
paramB.Value = _b_cnt;

try
{
odbcCommand.ExecuteNonQuery();
}
catch (Exception ex)
{
Console.Error.WriteLine(DateTime.Now.ToString()
+ ex.Message);
throw ex;
}

The SP itself looks like:
CREATE OR REPLACE PROCEDURE myProc (
A_CNT IN BINARY_INTEGER,
B_CNT IN BINARY_INTEGER) AS
BEGIN
NULL;
COMMIT;
END;

I tried to directly use
odbcCommand.CommandText = "BEGIN myProc(1, 2); END;";
And that works! However, unfortunately I actually need to use the two
variables _a_cnt and _b_cnt as input arguments for the SP. Then I got
following error message which complains about the question mark in
"BEGIN myProc(?, ?); END;"

ERROR [HY000]
[Oracle][ODBC][Ora]ORA-06550: line 1, column 14:PLS-00103: Encountered
the symbol
"" when expecting one of the following: ( ) - + case mod new not null
others
<an identifier>
<a double-quoted delimited-identifier> <a bind variable>
table avg count current exists max min prior sql stddev sum
variance execute multiset the both leading trailing forall
merge year month DAY_ hour minute second timezone_hour
timezone_minute timezone_region timezone_abbr time timestamp
interval date
<a

The suspicious symbol in the error message is a question mark upside
down.

Oracle 10g release 2.
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [2 Posts] View previous topic :: View next topic
The time now is Fri Nov 21, 2008 6:04 pm | All times are GMT
navigation Forum index » Databases » Oracle
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts postfix smtp authentication using mysql stored user/pass rtresidd Postfix 0 Fri Oct 03, 2008 5:58 am
No new posts Move Oracle 10g database to another location Selt Server 0 Fri Jul 21, 2006 2:14 pm
No new posts Oracle runtime Spitfire Server 0 Fri Jul 21, 2006 1:18 pm
No new posts How to ALTER a table using the ALTOBJ procedure Serge Rielau IBM DB2 1 Fri Jul 21, 2006 1:06 pm
No new posts Oracle Text Score Computation jatinder.1975@gmail.com Server 0 Fri Jul 21, 2006 1:00 pm

Electricity Suppliers | Loans | Bargain Flights | Loans | Mobile Phones
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.3033s ][ Queries: 20 (0.1995s) ][ GZIP on - Debug on ]