Given an Oracle package that
returns multiple result sets for related tables as
CURSOR data types, you want
to access this data using a
DataReader and load
the data into a
Use the data type
The sample code creates a
Command for an Oracle
CURSPKG that takes a
Customer ID input parameter. The package calls a
stored procedure that returns two result sets—Orders and Order
Details data from Northwind for the specified customer—as
REF CURSOR output parameters.
DataAdapter is created from the
Command, retrieves the Orders and Order Details
result sets, and loads them into a
relation is created between the tables and the default view for the
Orders table is bound to the data grid on the form.
DataReader is created from the
Command. The Orders and Order Details result sets
are displayed in a text box.
Example 2-27. File: Packages\CURSPKG
CREATE OR REPLACE PACKAGE CURSPKG AS TYPE T_CURSOR IS REF CURSOR; PROCEDURE GetCustomerOrdersWithDetails ( pCustomerID IN CHAR, curOrders OUT T_CURSOR, curOrderDetails OUT T_CURSOR); END CURSPKG;
Example 2-28. File: Package Bodies\CURSPKG
CREATE OR REPLACE PACKAGE BODY CURSPKG AS PROCEDURE GetCustomerOrdersWithDetails ( pCustomerID IN CHAR, curOrders OUT T_CURSOR, curOrderDetails OUT T_CURSOR ) IS V_CURSOR1 T_CURSOR; V_CURSOR2 T_CURSOR; BEGIN OPEN ...