Solved

Running PL/SQL Stored Procedure from C# using ADO.net (PL/SQL Table Datatype)

Posted on 2003-10-27
2
1,817 Views
Last Modified: 2007-12-19
Hi,

I am trying to run a third party PL/SQL stored procedure held on an Oracle database, using an ADO.net command in a C# application. However, I cannot match a PL/SQL Table datatype parameter in the stored procedure with any ADO.NET datatype.

Using OO4O in VBA I am able to create a table-parameter using OraDatabase.Parameters.AddTable. Is there any way of doing this in ADO.NET?

Thanks in advance...

 
0
Comment
Question by:tgannetts
2 Comments
 

Accepted Solution

by:
chrisalexander earned 100 total points
ID: 9639724
Oh the pain... I just finished dealing with the issue of using OraTypes in C# and it hurt. Firstly, I believe that Oracle's native .NET provider called Oracle Data Provider (ODP.NET) supports PL/SQL table collections. Go to Oracle.com to download ODP.NET on your dev workstation. Secondly, if this doesn't work then things are going to get alittle messy because you will have to unbox OraTypes to OO4O types. I would recommend using VB.NET and OO4O to create a unit test case of manipulating the PL/SQL table collection. F10 through this block of code to observe the OO4O datatype of each variable. In C# you will have to declare variables of these datatypes (ie OraCollection ObjCol;). Because the RunTime is serverely type safe you will need to unbox the PL/SQL table collection item OraTypes to the OO4O datatypes.

Although Oracle bitches about not supporting OO4O with .NET and the cominterop penalty I have been able to get a web-based app working just fine using Object data types. Just be careful if you use OO4O connection pooling as it does NOT remove connections when shutting down the application; connections become inactive and require some Oracle admin sniping/killing skill.

P.S. log onto MetaLink and explore. Again, the techs are pretty bitchy about answering OO4O/C# related questions though.

Hope this helps,

Chris
0
 
LVL 5

Author Comment

by:tgannetts
ID: 9656426
Thanks Chris,

I had a look at ODP, but we have Oracle 8i - Oracle 9i required.

As you suggested, I tried using OO4O in vb.net. The code I had already written in vba transferred nicely with little re-working required. (in fact with dbnull.value support it worked a lot better).

As far as C# is concerned, as a quick work around I have put all my vba code into a vb.net class library, and am referencing this from my C# application.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Bit flags and bit flag manipulation is perhaps one of the most underrated strategies in programming, likely because most programmers developing in high-level languages rely too much on the high-level features, and forget about the low-level ones. Th…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video discusses moving either the default database or any database to a new volume.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now