G
Guest
I'm trying to use the Enterprise Library to return result sets from Oracle
using a package which returns a reference cursor. While this works outside
the Library using the OracleClient namespace objects directly, I can't get it
to work inside the library. Package access doesn't seem to work at all.
Direct SQL access works great. Has anyone tried to return result sets using a
reference cursor to with the Library? Code snippets are below...
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);
}
and finally, the error I'm getting...
-------------------------------
{"ORA-06550: line 1, column 14:\nPLS-00103: Encountered the symbol
\"PACKAGE\" when expecting one of the following:\n\n := . ( @ % ;\nThe
symbol \":=\" was substituted for \"PACKAGE\" to continue.\n" }
Any help will be greatly appreciated. Thanks!
using a package which returns a reference cursor. While this works outside
the Library using the OracleClient namespace objects directly, I can't get it
to work inside the library. Package access doesn't seem to work at all.
Direct SQL access works great. Has anyone tried to return result sets using a
reference cursor to with the Library? Code snippets are below...
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);
}
and finally, the error I'm getting...
-------------------------------
{"ORA-06550: line 1, column 14:\nPLS-00103: Encountered the symbol
\"PACKAGE\" when expecting one of the following:\n\n := . ( @ % ;\nThe
symbol \":=\" was substituted for \"PACKAGE\" to continue.\n" }
Any help will be greatly appreciated. Thanks!