G
Galia via DotNetMonster.com
I have the trouble with the stored procedure returning ref cursor.
I used the code provided by Horst.
The Package ...
----------------------
CREATE OR REPLACE PACKAGE employee_main
AS
TYPE ref_cursor_type IS REF CURSOR;
PROCEDURE get_employees (emp_cursor OUT ref_cursor_type);
END employee_main;
/
CREATE OR REPLACE PACKAGE BODY employee_main
AS
PROCEDURE get_employees (emp_cursor OUT ref_cursor_type)
IS
BEGIN
OPEN emp_cursor FOR
SELECT *
FROM employees;
END get_employees;
END employee_main;
/
The C# snippet which accesses the package...
---------------------------------
public DataSet GetEmployeeData() {
string pkgName = "employee_main.get_employees";
Database db=DatabaseFactory.CreateDatabase();
DBCommandWrapper cmdWrapper = db.GetStoredProcCommandWrapper(pkgName);
cmdWrapper.AddOutParameter("emp_cursor", DbType.Object, 2000);
return db.ExecuteDataSet(cmdWrapper);
}
Another procedure that updates the record with only IN and OUT parameters
executes without problems. However as soon as I try to include parameter
cmdWrapper.AddOutParameter("emp_cursor", DbType.Object, 2000);
it gives me error on execution db.ExecuteDataSet(cmdWrapper):
"ORA-06550: line 1, column 7:\nPLS-00306: wrong number or types of
arguments in call to 'GET_VERSIONS'\nORA-06550: line 1, column 7:\nPL/SQL:
Statement ignored\n"
Help greatly appreciated.
I used the code provided by Horst.
The Package ...
----------------------
CREATE OR REPLACE PACKAGE employee_main
AS
TYPE ref_cursor_type IS REF CURSOR;
PROCEDURE get_employees (emp_cursor OUT ref_cursor_type);
END employee_main;
/
CREATE OR REPLACE PACKAGE BODY employee_main
AS
PROCEDURE get_employees (emp_cursor OUT ref_cursor_type)
IS
BEGIN
OPEN emp_cursor FOR
SELECT *
FROM employees;
END get_employees;
END employee_main;
/
The C# snippet which accesses the package...
---------------------------------
public DataSet GetEmployeeData() {
string pkgName = "employee_main.get_employees";
Database db=DatabaseFactory.CreateDatabase();
DBCommandWrapper cmdWrapper = db.GetStoredProcCommandWrapper(pkgName);
cmdWrapper.AddOutParameter("emp_cursor", DbType.Object, 2000);
return db.ExecuteDataSet(cmdWrapper);
}
Another procedure that updates the record with only IN and OUT parameters
executes without problems. However as soon as I try to include parameter
cmdWrapper.AddOutParameter("emp_cursor", DbType.Object, 2000);
it gives me error on execution db.ExecuteDataSet(cmdWrapper):
"ORA-06550: line 1, column 7:\nPLS-00306: wrong number or types of
arguments in call to 'GET_VERSIONS'\nORA-06550: line 1, column 7:\nPL/SQL:
Statement ignored\n"
Help greatly appreciated.