| Oracle® Data Provider for .NET Developer's Guide Release 9.2.0.4 Part Number B10961-01 |
|
Oracle.DataAccess.Types Namespace (ODP.NET Types), 17 of 19
An OracleRefCursor object represents an Oracle REF CURSOR.
Object
MarshalRefByObject
OracleRefCursor
// C# public sealed class OracleRefCursor : MarshalRefByObject, IDisposable
All public static methods are thread-safe, although instance methods do not guarantee thread safety.
// C# // Example demonstrates how to use a REF CURSOR as an output parameter ... // 1. Assume you have a stored procedure called MyPack.MyProc created with // the following function, which returns 1 REF CURSOR and contains one REF // CURSOR as an output parameter // FUNCTION MyProc (...) // BEGIN // open p_cursor for select * from multimedia_tab; // open p_cursor1 for select * from emp; // return (p_cursor); // END MyProc; // ... // // 2. Assume you have a valid connection // Set the command OracleCommand cmd = new OracleCommand("MyPack.MyProc", con); cmd.CommandType = CommandType.StoredProcedure; // Bind // select * from multimedia_tab; OracleParameter p1 = cmd.Parameters.Add("refcursor1", OracleDbType.RefCursor); p1.Direction = ParameterDirection.ReturnValue; // select * from emp OracleParameter p2 = cmd.Parameters.Add("refcursor2", OracleDbType.RefCursor); p2.Direction = ParameterDirection.Output; // Execute command cmd.ExecuteNonQuery(); ... DataReader reader = p1.Value.GetDataReader(); Console.WriteLine("Field count: " + reader.FieldCount); ...
Namespace: Oracle.DataAccess.Types
Assembly: Oracle.DataAccess.dll
OracleRefCursor members are listed in the following tables:
OracleRefCursor static methods are listed in Table 5-174.
| Methods | Description |
|---|---|
|
|
Inherited from |
OracleRefCursor properties are listed in Table 5-175.
| Properties | Description |
|---|---|
|
A reference to the |
OracleRefCursor instance methods are listed in Table 5-176.
OracleRefCursor static methods are listed in Table 5-177.
| Methods | Description |
|---|---|
|
|
Inherited from |
OracleRefCursor properties are listed in Table 5-178.
| Properties | Description |
|---|---|
|
A reference to the |
This property refers to the OracleConnection used to fetch the REF CURSOR data.
// C# public OracleConnection Connection {get;}
An OracleConnection.
ObjectDisposedException - The object is already disposed.
This property is bound to a REF CURSOR once it is set. After the OracleRefCursor object is created by the constructor, this property is initially null. An OracleRefCursor object can be bound to a REF CURSOR after a command execution.
If the connection is closed or returned to the connection pool, the OracleRefCursor is placed in an uninitialized state and no operation can be carried out from it. However, the uninitialized OracleRefCursor can be reassigned to another REF CURSOR.
OracleRefCursor instance methods are listed in Table 5-179.
This instance method disposes of the resources allocated by the OracleRefCursor object.
// C# public void Dispose();
IDisposable
The object cannot be reused after being disposed.
Once Dispose() is called, the object of OracleRefCursor is in an uninitialized state. Although some properties can still be accessed, their values may not be accountable. Since resources are freed, method calls can lead to exceptions.
This instance method returns an OracleDataReader object for the REF CURSOR.
// C# public OracleDataReader GetDataReader();
OracleDataReader
Using the OracleDataReader, rows can be fetched from the REF CURSOR.
|
|
![]() Copyright © 2002, 2003 Oracle Corporation. All Rights Reserved. |
|