This .NET sample application demonstrates how to populate a DataSet
with data from multiple Ref Cursors from PL/SQL stored procedure
through Oracle Provider for OLE DB. The Oracle9i Release 2 OLE DB
provider introduces full support for .NET via the Microsoft OLE
DB .NET data provider. With OLE DB .NET, applications can access
the Oracle database from any .NET programming language.
To return Ref Cursor from a PL/SQL stored procedure, a variable
of Ref Cursor type is used as OUT parameter from Stored Procedure.
This parameter is not required to be bound to the Stored Procedure
call in the application. Oracle Provider for OLE DB automatically
binds the Ref Cursor variables and returns the records appropriately.
To enable the Data Provider to bind Ref Cursor variables automatically,
the attribute 'PLSQRSet' should be set to true while getting the
connection from database.
The PL/SQL Stored Procedure returning multiple Ref Cursors is called
using OleDbCommand Object. The OleDbDataAdapter executes this command
object. OleDbDataAdapter fills the DataSet with Ref Cursors returned
from the Stored Procedure. The No. of Data Tables created in the
DataSet is equal to the No. of Ref Cursors returned from the Stored
Procedure. The Data Tables are named as 'TableN' where N stands
for an integer starting from 0. These Data Tables can be bound to
different Data Grids.
When this sample application is run, two Data Grids are displayed.
One Data Grid populated with records for products with 'Orderable'
product status and other Data Grid populated with records for products
with 'Under Development' product status. A PL/SQL Stored Procedure
'GetProductsInfo' is called that returns two Ref cursors as 'OUT'
parameters. The DataSet is filled with data in Ref Cursor. The two
Data Tables created are 'Products' and 'Products1'. The Data Grids
are bound to these Data Tables. Hence demonstrating how to
populate DataSet with multiple ref Cursors.
|