Login Skip Navigation LinksWilsonORMapper > Forums Search
Demo Version Demo Version
Download and try for yourself a fully working demo version, including sample apps and documentation.  The only limitation is that the demo version only works inside the debugger.

PayPal Subscribe
Get It All for $50 USD:
WebPortal, ORMapper,
Source Code, All Updates
PayPal

User Login User Login
Log In
 
 
Reset Password

Wilson ORMapper Forums Wilson ORMapper Forums : Other Databases : Oracle and SelectProcedure

Date Post
4/7/2006 12:31:54 AM

I'm starting a new project in Oracle (which I'm very new to) using ORMapper 3.2 (I started using it a while back and we're still using it for other projects).

Everything works perfectly well except calling stored procedures (I'm guessing this is because Oracle requires a cursor output parameter).  Is there a way to get this working? Does the new version support SelectProcedures in Oracle?

4/7/2006 12:35:53 AM Nothing has changed -- its on my list to hopefully someday get to, but so far there are very few Oracle users, and even fewer worried about stored procs -- admittedly not a good excuse, but it does drive priorities.

Thanks, Paul Wilson
4/8/2006 12:22:40 AM

Ok, I found a quick workaround/hack to get it to work for me.  I'll post it just there's anybody out there as crazy as I am... :-)

After reading this page that microsoft graciously made:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnadonet/html/msdnorsps.asp

I realized all that needed to be done was to add an output parameter of type OracleType.Cursor.  But since the IDataParamater.DbType didn't have that type, and I didn't want to change much code, I changed the code in the 'else parameter.Type is null' portion of Wilson.ORMapper.Internals.Connection.GetParameter(...) to this:

if (dbParameter is System.Data.OracleClient.OracleParameter && dbParameter.Direction == ParameterDirection.Output)
{
   ((
System.Data.OracleClient.OracleParameter)dbParameter).OracleType = System.Data.OracleClient.OracleType.Cursor;
}
else
{
   dbParameter.DbType = DbType.String;
}

Basically it implies that if you're using oracle, and setting an ouput parameter of an unknown type, use the OracleType.Cursor.  Since setting the cursor is all that's necessary for the DataReader to return results, that's all I needed for it to work (besides adding the parameter to the SelectProcedure to specify the name of the cursor variable, which I do only if I'm using Oracle as the provider).

4/8/2006 12:24:12 AM Thanks -- very useful -- I'll see if I can add this to the main codebase without any issues.  Drop me a line if you want your name and/or a link of some type in the code.

Thanks again, Paul Wilson