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!

Help - Oracle function w/RETURN VIEW_NAME%ROWTYPE

452123Sep 27 2005 — edited Oct 6 2005
I have a fairly complex Oracle function with a signature like this:

FUNCTION get_some_data
(
in_param_one VARCHAR2
, in_param_two VARCHAR2
)RETURN VIEW_NAME%ROWTYPE

(The internal logic of the function is such that it will return at most one row.)

I have sample code from MSDN that outlines calling functions in .Net, like this:

// create the command for the function
OracleCommand cmd = new OracleCommand();
cmd.Connection = conn;
cmd.CommandText = "GET_EMPLOYEE_EMAIL";
cmd.CommandType = CommandType.StoredProcedure;

// add the parameters, including the return parameter to retrieve
// the return value
cmd.Parameters.Add("p_employee_id", OracleType.Number).Value = 101;
cmd.Parameters.Add("p_email", OracleType.VarChar, 25).Direction =
ParameterDirection.ReturnValue;

// execute the function
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();

// output the result
Console.WriteLine("Email address is: " + cmd.Parameters["p_email"].Value);


I don't see an available OracleType to fit the '...%ROWTYPE' return value.

I think the Oracle code is doing inferred 'table inlining' but it may, instead, be using an inferred refcursor (clearly I'm no DBA). Everything I've been able to find online when googling for how to handle this in .Net doesn't seem to match this situation.

How can I call this function and get the data back in C#? Please note that I don't have the authority to modify the package to make it explicitly return a refcursor.

Thank you for any light you can shed!

MarFarMa
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 3 2005
Added on Sep 27 2005
9 comments
16,022 views