PC Review


Reply
Thread Tools Rate Thread

getting the oracle stored proc value in .net

 
 
=?Utf-8?B?Vmlua2k=?=
Guest
Posts: n/a
 
      12th Jun 2007
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 value in my .net code

Below is my .net code

OracleParameter mbrid = new OracleParameter("RET_MBRID", OracleType.Number);
mbrid.Direction = ParameterDirection.Output;

OracleDataReader reader;
reader = command.ExecuteReader();
while (reader.Read())
{
memberId = (string)reader["RET_MBRID"];

}

I tested the oracle stored proc in sqlPlus and it is returning me value, but
when i go to .net code, i cannot see the value of memberId. Am I doing
something wrong here. Although my insert and update are working fine.

Insert and update statements are defined in the same stored proc.

I spent lot of time on this, but still cannot figure out why am I not
getting the return value from oracle stored proc. I cannot even go inside the
while(Reader.red()) statement

Any help will be grealty appreciated.
 
Reply With Quote
 
 
 
 
Cowboy \(Gregory A. Beamer\)
Guest
Posts: n/a
 
      13th Jun 2007
For most things, in Oracle, it is easiest to return a ref cursor, which
creates a Dataset. YOu have to declare this output type to link it up.

THe other option is to focus on ODP.NET instead of the built in Microsoft
stuff. As it was created by Oracle, it seems to work better in most
instances.

As for why you are not seeing anything, it is simple. You are not polling
the output parameter, you are trying to read the same value from a Reader.
If you just need a simple value, as an output parameter, just execute non
query and get the value from the parameter.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
Co-author: Microsoft Expression Web Bible (upcoming)

************************************************
Think outside the box!
************************************************
"Vinki" <(E-Mail Removed)> wrote in message
news:4072C656-FBC6-4872-8CC6-(E-Mail Removed)...
> 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 value in my .net code
>
> Below is my .net code
>
> OracleParameter mbrid = new OracleParameter("RET_MBRID",
> OracleType.Number);
> mbrid.Direction = ParameterDirection.Output;
>
> OracleDataReader reader;
> reader = command.ExecuteReader();
> while (reader.Read())
> {
> memberId = (string)reader["RET_MBRID"];
>
> }
>
> I tested the oracle stored proc in sqlPlus and it is returning me value,
> but
> when i go to .net code, i cannot see the value of memberId. Am I doing
> something wrong here. Although my insert and update are working fine.
>
> Insert and update statements are defined in the same stored proc.
>
> I spent lot of time on this, but still cannot figure out why am I not
> getting the return value from oracle stored proc. I cannot even go inside
> the
> while(Reader.red()) statement
>
> Any help will be grealty appreciated.



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
return value from Oracle stored proc =?Utf-8?B?Vmlua2k=?= Microsoft C# .NET 2 12th Jun 2007 11:08 PM
calling oracle stored proc from .net =?Utf-8?B?Vmlua2k=?= Microsoft C# .NET 3 12th Jun 2007 02:34 AM
calling stored proc from oracle =?Utf-8?B?Vmlua2k=?= Microsoft C# .NET 0 12th Jun 2007 02:09 AM
stored proc /w Oracle and Ado.Net coltrane Microsoft ADO .NET 5 2nd May 2005 01:27 PM
exec Oracle stored proc Microsoft Access Queries 1 28th Oct 2003 01:17 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:32 PM.