Returning REF Cursor from PL/SQL Function problem! [message #502305] |
Tue, 05 April 2011 13:53 |
|
aucrun
Messages: 114 Registered: February 2011
|
Senior Member |
|
|
Hi,
I've seen several code samples that show how to return a REFCURSOR from a Stored Function, but when I try it with C# it gives me allways WRONG NUMBER OF ARGUMENTS or somehing like that.
I presently don't have my code in here, but it is something like this:
cmd.Parameters.add ("parRefCursor", dbresult.RefCursor, direction.Result);
I'm being able to use it as a OUT parameter, but I would like to have it as a RETURN value from a Function.
Is it possible?
Thanks!
|
|
|
|
|
|
Re: Returning REF Cursor from PL/SQL Function problem! [message #502311 is a reply to message #502309] |
Tue, 05 April 2011 14:21 |
|
aucrun
Messages: 114 Registered: February 2011
|
Senior Member |
|
|
For the case of someone eles have this same problem, that might be a noob problem, it is necessary to place the ReturnValues Parameters befores the Input Parameters when creating the OracleCommand!
Samples below:
OracleCommand cmd = new OracleCommand("calculateparentclassnodes_DEL3", con);
cmd.CommandType = System.Data.CommandType.StoredProcedure;
OracleParameter pCode = new OracleParameter("iCode", OracleDbType.Varchar2, 50);
pCode.Direction = System.Data.ParameterDirection.Input;
pCode.Value = "77014000";
OracleParameter pAgency = new OracleParameter("iAgency", OracleDbType.Varchar2);
pAgency.Direction = System.Data.ParameterDirection.Input;
pAgency.Value = "GPC";
OracleParameter pResult = new OracleParameter("cur_testes", OracleDbType.RefCursor, System.Data.ParameterDirection.ReturnValue);
cmd.Parameters.Add(pResult);
cmd.Parameters.Add(pCode);
cmd.Parameters.Add(pAgency);
Thanks!
[Updated on: Wed, 06 April 2011 07:31] Report message to a moderator
|
|
|