Get package out to dataset

Get package out to dataset

Postby aspirany » Sun 25 Apr 2010 01:20

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
aspirany
 
Posts: 12
Joined: Mon 04 Sep 2006 16:51

Postby StanislavK » Mon 26 Apr 2010 11:28

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/docs/DataSetWizard.html
and in Package Wizard (Tools -> Oracle -> Oracle Package Wizard), with the help of which you may create typed OraclePackages.
StanislavK
Devart Team
 
Posts: 1710
Joined: Thu 03 Dec 2009 10:48


Return to dotConnect for Oracle