473,396 Members | 1,975 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Web Service and Oracle Stored procedures

132 100+
Hi there.

I am writing a web service in C# that connects to an Oracle database via OleDb and wish for the service to return a dataset for use by a client application. I have achieved this using dynamic sql but now there is a requirement to use stored procedures instead, thus calling these from the web service.

As I am using OleDb to connect to the Oracle database, what method is the best way forward here to achieve the results I am after, please? I have been reading about the use of REF CURSOR but I'm not sure if this is the best approach.

Here is an example of one of the stored procedures I am using:

Expand|Select|Wrap|Line Numbers
  1.  
  2. CREATE OR REPLACE PROCEDURE SADAS_MANAGER.NLPGAddSearchOne
  3.  
  4. (
  5.     p_postcode          in varchar2, 
  6.     p_paostartnumber    in int,
  7.     fullAdd            out varchar2
  8.  
  9.  
  10. IS 
  11.  
  12. BEGIN
  13.  
  14. select full_address into fullAdd from nlpg_uk where POST_CODE = p_postcode AND PAO_START_NUMBER = p_paostartnumber 
  15. ORDER BY ABS(PAO_START_NUMBER) ASC
  16.  
  17. ;
  18. END;
  19. /
  20.  
  21.  
and the corresponding method call from the Web Service:

Expand|Select|Wrap|Line Numbers
  1.  
  2. [WebMethod (Description = "Return address details based on two parameters (string, int) corresponding to post code and house number and run type = NLPG")]
  3.     public DataSet NLPGAddressSearchOne(string whereValue1, int whereValue2) 
  4.     {
  5.         OleDbConnection conn = GetConn();
  6.         conn.Open();
  7.  
  8.         OleDbCommand sComm = new OleDbCommand("NLPGAddSearchOne", conn);
  9.         sComm.CommandType = CommandType.StoredProcedure;
  10.         sComm.Parameters.Add("p_postcode", OleDbType.Char).Value = whereValue1;
  11.         sComm.Parameters.Add("p_paostartnumber", OleDbType.Integer).Value = whereValue2;
  12.  
  13.         OleDbDataAdapter dataAdapter = new OleDbDataAdapter(sComm);
  14.         DataSet addDataSet = new DataSet();
  15.  
  16.         dataAdapter.Fill(addDataSet);
  17.  
  18.         return addDataSet;
  19.     }
  20.  
  21.  
Hopefully that is all clear and that somebody can help me on my with this please?

Thank you.

M :)
Jan 6 '09 #1
2 5755
E11esar
132 100+
Hi there. I have found a solution to this which can be found via the following link:

Oracle Ref Cursor - ASP.NET Forums

Hopefully this may be of use to somebody else.

Thank you.

M :)
Jan 6 '09 #2
mldisibio
190 Expert 100+
It's been awhile since I've pulled data into DataSets from Oracle, but would your first example/post work if you removed the output parameter and the "SELECT INTO"?

Expand|Select|Wrap|Line Numbers
  1. SELECT full_address 
  2.   FROM nlpg_uk 
  3. WHERE POST_CODE = p_postcode AND 
  4. PAO_START_NUMBER = p_paostartnumber 
  5. ORDER BY ABS(PAO_START_NUMBER) ASC
should return a dataset with one table and one column called "full_address".

The REF Cursor is a way to pass a set of rows as a variable or output parameter, and this is useful when calling one stored procedure from another where you want a set of rows to be returned instead of a single value.

However, since your web service is simply returning a dataset...I think that a simple SELECT statement will fill the DataSet. Your client calling the Web Service does not necessarily appear to need to manipulate the resultset as an output parameter.
Jan 6 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Suresh Tri | last post by:
Hi all, I am interested in extracting the class or jar files which are stored as java stored procedures in Oracle. But I want to know if these are stored as references to external files in...
1
by: Suresh Tri | last post by:
Hi all, I am in search of any Enterprise level Opensource Project that uses Java Stored Procedures supported by Oracle. I could not find any by googling. Can any one plese point me to any such...
133
by: jonathan | last post by:
hey all, I realize that this question might pop up from time to time, but I haven't seen it a while and things might of changed, so - Right now (July 2004) how does mysql stand up in...
11
by: jrefactors | last post by:
I want to know the differences between SQL Server 2000 stored procedures and oracle stored procedures? Do they have different syntax? The concept should be the same that the stored procedures...
3
by: IGotYourDotNet | last post by:
Can anyone point me to some example ASP.NET apps that use Oracle has a backend and C# as the language? I need to figure out how to populate a drop down, and then a datagrid depending on what the...
1
by: Chad | last post by:
Hi, I am a SQL Server programmer using Oracle for the first time. In our .NET client apps which use a SQL Server back end, we would use Stored Procedure exclusively for all database access for...
14
by: jehugaleahsa | last post by:
Hello: I am working with Oracle .NET Stored Procedures. I would like to know how to return the results of a SELECT statement. I have tried returning a OracleRefCursor and a DataTable, but...
2
by: ink | last post by:
Hi all, My company does things in a very specific way. Meaning we never query the database directly, we always use Stored Procedures. What i would like is to develop one data provider class...
4
by: --CELKO-- | last post by:
I need to convert a bunch of DB2 triggers to Oracle. Is there any kind of tools for this?
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.