Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / May 2005

Tip: Looking for answers? Try searching our database.

Oracle Reference Cursors using Enterprise Library

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Horst - 09 Mar 2005 00:11 GMT
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!
Signature

Horst

Cowboy (Gregory A. Beamer) - MVP - 09 Mar 2005 19:54 GMT
With OracleClient, you have to create an output parameter for every
REF_CURSOR you are outputting. WIth OleDb, you do not. Have to tried with a
package, but the above rules work well with sprocs.

I prefer ODP.NET (http://otn.oracle.com) to the OracleClient namespace.
NOTE: If you move to 10g, you will have to go to ODP.NET, as the MS libraries
have not been changed to reflect changes in the Oracle database.
---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************

> 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
[quoted text clipped - 44 lines]
>
> Any help will be greatly appreciated. Thanks!
Horst - 09 Mar 2005 21:41 GMT
I thought I was creating an output parameter (see C# snippet below). But I'm
having the same problem with every stored procedure or package call using the
MS libraries, even the ones without parameters, and I get the very same error
message shown below. In fact I've called non-existent stored procedures and
get that error message. It all works properly when I don't use the library
and write my own database access code.

We've looked at earlier versions of ODP.NET and found they were too
sensitive to minor version changes and tended to break when patches were
applied to the database. Has that changed in the recent versions?

> With OracleClient, you have to create an output parameter for every
> REF_CURSOR you are outputting. WIth OleDb, you do not. Have to tried with a
[quoted text clipped - 60 lines]
> >
> > Any help will be greatly appreciated. Thanks!
Horst - 10 Mar 2005 19:37 GMT
Downloaded ODP.NET and tried that. It works GREAT! Thanks!

> With OracleClient, you have to create an output parameter for every
> REF_CURSOR you are outputting. WIth OleDb, you do not. Have to tried with a
[quoted text clipped - 60 lines]
> >
> > Any help will be greatly appreciated. Thanks!
Rob - 07 Apr 2005 19:25 GMT
> 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
[quoted text clipped - 46 lines]
> --
> Horst

I got this same error until i stepped through the code.  There seems to
be some weird bug where the Name part of the NVP from the Oracle
Package part of the config file is used instead of the Value part.  If
you left things as default you have a NVP of Oracle
Package/PACKAGE_NAME  What's actually happening is that the code is
putting ORACLE PACKAGE.MY_STORED_PROC as the execution.  The space
throws it off and you get the error you listed.  I am still having
trouble with a SP that returns a REF CURSOR, but that is a different
issue.
Galia - 06 May 2005 16:38 GMT
Have you resolved the trouble with the sproc returning ref cursor?

I am used code provided by Horst. I overcame the package problem by
deleting the Package setting from the dataconfiguration.config.

However i am still cann't get around the error
"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" while executing
db.ExecuteDataSet(cmdWrapper).
Help greatly appreciated.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.