Page 1 of 1

Get package out to dataset

Posted: Sun 25 Apr 2010 01:20
by aspirany
Hi every body!

I would like collect package out parameter to dataset

c#

string sql = "CEGEK_PKG.OPENCURSOR";
OracleCommand command = new OracleCommand();
DataSet ds = new DataSet();

command.CommandText = sql;
oracleConnection1.Open();
command.Connection = oracleConnection1;
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add("EMPCURSOR",OracleDbType.Cursor).Direction = ParameterDirection.Output;


OracleDataAdapter adapter = new OracleDataAdapter(command);
adapter.TableMappings.Add("Table", "CEGEK");

adapter.Fill(ds);

this code not working:

ORA-06550: line 2, column 13:
PLS-00302: component 'OPENCURSOR' must be declared
ORA-06550: line 2, column 3:
PL/SQL: Statement ignored

How can i solv this problem.Or there is any other method?

Thanks for your answer

Posted: Mon 26 Apr 2010 11:28
by StanislavK
Please check whether you are able to execute the procedure with some standard tool, like SQL*Plus. If possible, please send us the definition of CEGEK_PKG.OPENCURSOR. I've tried your sample on a simple procedure that returns a cursor, and the data set was successfully filled.

As for other methods, you may be interested in Devart DataSet Wizard which allows to create typed DataSets using stored procedures:
http://www.devart.com/dotconnect/oracle ... izard.html
and in Package Wizard (Tools -> Oracle -> Oracle Package Wizard), with the help of which you may create typed OraclePackages.