Problem with Oracle RefCursor

I am using ODP.NET (migration from a Microsoft provider) and I am stuck in a stored procedure that returns refcursor. I have the following PL / SQL procedure (I modified it a bit to make it more general):

PROCEDURE MyProc(parameter_no1 IN NUMBER, parameter_no2 IN NUMBER, RETCURSOR OUT ret_type) AS BEGIN OPEN RETCURSOR FOR SELECT ad.logo logo FROM tab_a a, tab_h h WHERE a.id IS NOT NULL AND a.h_id = h.id AND a.no1 = parameter_no1 AND a.no2= parameter_no2; END HanteraLogotype; 

And then I have the following C # code to call it:

 internal void RefCursorDataReader() { OracleCommand cmd = new OracleCommand("ABC$MYPACKAGE.MyProc", new OracleConnection(_constr)); cmd.CommandType = CommandType.StoredProcedure; cmd.Connection.Open(); cmd.BindByName = true; OracleParameter p = cmd.Parameters.Add("parameter_no1", OracleDbType.Decimal); p.Value = 12345678; p.Direction = ParameterDirection.Input; p = cmd.Parameters.Add("parameter_no2", OracleDbType.Decimal); p.Value = 123456; p.Direction = ParameterDirection.Input; p = cmd.Parameters.Add("RETCURSOR", OracleDbType.RefCursor); p.Direction = ParameterDirection.Output; OracleDataReader reader = cmd.ExecuteReader(); if (reader.Read()) { System.Diagnostics.Debug.WriteLine(reader[0].GetType().ToString()); } cmd.Connection.Close(); } 

And when I run this, I get this exception:

ORA-03106: fatal communication protocol error with two tasks

I tried many different options for the parameters, their type, order, etc., but nothing helps. This is reader.Read() , which throws an exception. I am very grateful for the help in this!

Added: ret_type parameter is defined as:

TYPE ret_type IS REF CURSOR;

0
source share
2 answers

This seems like a mistake. Error 3106 is a bad mistake that should never be. I am sure there is a workaround!

The best place to ask ODP.NET questions has been completed on the OTN ODP.NET forum. If I were you, I would publish it there:

http://forums.oracle.com/forums/forum.jspa?forumID=146&start=0

Also find this forum for "3106"

+1
source

I upgraded to 11G ODP.NET

0
source

All Articles