In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
How to call Oracle stored procedures with cursors in C #. In order to solve this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.
Stored procedure
Let's first write a simple stored procedure named sTest in our Oracle database, with one input parameter ps_SaleNo and three output parameters pi_Result,ps_Message,pc_cursor as shown below:
Where the CCurType type is the output cursor variable we defined.
The statement in the blue box above is the dataset of the output cursor. If we extract this sentence and query it separately, we can see the returned result, as shown in the following figure:
Code implementation
We open VS2017 and create a new C# project named TestOraCursor.
1. Quote Oracle.ManagedDataAccess
To call a stored procedure with a cursor, we must reference Oracle.ManagedDataAccess for two reasons:
Clients that do not need to install OracleClient
There is no RefCursor type in the parameter type of the original OracleClient, so it is impossible to call the stored procedure that returns the cursor.
We right-click on the program reference and select the package that manages the NuGet.
Then enter Oracle in the browse to find the Oracle.ManagedDataAccess and download it.
two。 Create a form
Create a new form FrmTest and add a Button and a textbox control to the form, as shown below:
We double-click the button event to write the code
The red box above is the connection setting of the database, and the red box below is the method of executing the stored procedure.
4. Core code
Next, let's take a look at the effect of running.
This is the answer to the question about how to call Oracle stored procedures with cursors in c #. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.