[Mono-list] re f cursor issue in oracle stored procedure invoked from mono
Daniel Morgan
monodanmorg at yahoo.com
Tue Sep 2 13:17:55 EDT 2008
Here is a more complete test case in C#. I changed the stored procedure name to SP_TEST_REF_CURSOR.
// test.cs
// mcs test.cs /r:System.Data.dll /r:System.Data.OracleClient.dll
using System;
using System.Data;
using System.Data.Common;
using System.Data.OracleClient;
public class test
{
public static void Main(string[] args)
{
Console.WriteLine("Start.");
OracleConnection con = new OracleConnection("Data source=testdb;user id=someuser;password=somepass");
con.Open();
OracleCommand cmdSp = con.CreateCommand();
//cmdSp.CommandType = CommandType.StoredProcedure;
//cmdSp.CommandText = "SP_TEST_REF_CURSOR";
cmdSp.CommandText = "BEGIN\n SP_TEST_REF_CURSOR(:crsdata); \nEND;\n";
DataSet ds = new DataSet();
OracleParameter oprCursor = new OracleParameter("crsdata", OracleType.Cursor);
oprCursor.Direction = ParameterDirection.Output;
cmdSp.Parameters.Add(oprCursor);
OracleDataAdapter dasp = new OracleDataAdapter(cmdSp);
try
{
dasp.Fill(ds);
Console.WriteLine("Success!");
}
catch (Exception e)
{
Console.Error.WriteLine("Error: " + e.Message);
Console.Error.WriteLine(e);
}
con.Close();
con = null;
}
}
--- On Tue, 9/2/08, Daniel Morgan <monodanmorg at yahoo.com> wrote:
> From: Daniel Morgan <monodanmorg at yahoo.com>
> Subject: Re: [Mono-list] re f cursor issue in oracle stored procedure invoked from mono
> To: mono-list at lists.ximian.com, "sumesh0710" <sumeshjose at gmail.com>
> Date: Tuesday, September 2, 2008, 1:11 PM
> Have you tried building mono from svn?
>
> Also, can you file a bug in bugzilla please?
>
>
> --- On Tue, 9/2/08, sumesh0710 <sumeshjose at gmail.com>
> wrote:
>
> > From: sumesh0710 <sumeshjose at gmail.com>
> > Subject: [Mono-list] re f cursor issue in oracle
> stored procedure invoked from mono
> > To: mono-list at lists.ximian.com
> > Date: Tuesday, September 2, 2008, 10:27 AM
> > Hi,
> > OS - Linux Version 2.6.9-42.0.0.0.1( Red hat version
> > 3.4.6-3.1)
> > Oracle - 9.2.0
> > mono - 1.2.4
> >
> > I have a simple procedure which has a ref cursor as
> > parameter as follows.
> >
> > CREATE OR REPLACE PROCEDURE
> > "DARSTRAN"."TEST" (crsdata out
> > sys_refcursor)
> > as
> >
> > BEGIN
> > open crsdata for select sysdate from dual;
> > END;
> >
> > If i execute this from proc from sql plus. It works
> fine.
> > Also in windows
> > OS, if i call from an application developed in vb.net
> it
> > will work. But same
> > code executed in mono in Linux OS shows below error
> while
> > filling into
> > dataset.
> > ora- 01403: no data found.
> >
> > Code used is
> >
> > cmdSp = New OracleCommand("test", con)
> > cmdSp.CommandType = CommandType.StoredProcedure
> > ds = New DataSet
> > oprCursor = New OracleParameter("crsdata",
> > OracleType.Cursor)
> > oprCursor.Direction = ParameterDirection.Output
> > cmdSp.Parameters.Add(oprCursor)
> > dasp = New OracleDataAdapter(cmdSp)
> > dasp.Fill(ds)
> >
> > If i execute above SP from linux sql plus, also it
> works
> > ok.
> >
> > Is there any workaround to solve this problem?
> > --
> > View this message in context:
> >
> http://www.nabble.com/ref-cursor-issue-in-oracle-stored-procedure-invoked-from-mono-tp19271280p19271280.html
> > Sent from the Mono - General mailing list archive at
> > Nabble.com.
> >
> > _______________________________________________
> > Mono-list maillist - Mono-list at lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-list
>
>
>
> _______________________________________________
> Mono-list maillist - Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
More information about the Mono-list
mailing list