Use .NET to call Oracle's stored procedure to return to record sets

xiaoxiao2021-03-06  104

Article Source: Wei.com has recently been a project, in order to improve database security, customers require all database operations to be stored in stored procedures. If the general update operation, it is easier to implement, it is easy to implement. And I want to return to records, I have trouble, I have checked online, and there are not many articles in this regard. Summary here for your reference. There is no introduction to how to access the Oracle database .NET. There are many related materials, interested friends can see below. Use ASP.NET to access the Oracle database http://blog.9cbs.net/gztoby/archive/2004/08/11/71748.aspx Oracle stored procedure Returns a recordset, the key is to use the cursor. Regarding the database of the database, everyone is certainly exposed to many, we can make a variety of convenient operations through the Open, Fetch, and Close operation control cursors, I will not be repeated. We now want to introduce the cursor variable. Similar cursors, the cursor variable also points to the current line of a query result set. Different, the cursor variable can be opened for any type of similarity-compatible, not binding to a particular query. With a cursor variable, you can get more convenience in the data extraction of the database. The first is to establish a table. CREATE TABLE LIHUAN.BILL_POINTS (POINTS_ID NUMBER (10,0) NOT NULL, CUSTOMER_ID NUMBER (10,0) NOT NULL, BILL_POINT_NO NUMBER (2,0) DEFAULT 1 NOT NULL, CONSTRAINT PK_BILL_POINTS PRIMARY KEY (POINTS_ID)) / Second, build PACKAGE CREATE OR REPLACE PACKAGE LIHUAN.YY_PKG_BILL_POINT_NO / * all charging electricity acquired user ID * / iSTYPE T_CURSOR iS REF CURSOR; PROCEDURE BILL_POINT_NO (P_CUSTOMER_ID BILL_POINTS.CUSTOMER_ID% TYPE, Re_CURSOR OUT T_CURSOR); END; / re-built PACKAGE BODYCREATE OR REPLACE PACKAGE BODY LIHUAN.YY_PKG_BILL_POINT_NO / * all charging electricity acquired user ID * / iS PROCEDURE BILL_POINT_NO (P_CUSTOMER_ID BILL_POINTS.CUSTOMER_ID% TYPE, Re_CURSOR OUT T_CURSOR) iS V_CURSOR T_CURSOR; BEGIN OPEN V_CURSOR FOR select Bill_Point_No from BILL_POINTS where CUSTOMER_ID = P_CUSTOMER_ID; RE_CURSOR: = V_CURSOR; END; END; / Final, program call in .NET.

转载请注明原文地址:https://www.9cbs.com/read-126894.html

New Post(0)