Skip Headers

Oracle® Data Provider for .NET Developer's Guide
Release 9.2.0.4

Part Number B10961-01
Go To Table Of Contents
Contents
Go To Index
Index

Go to previous page Go to beginning of chapter Go to next page

Oracle.DataAccess.Types Namespace (ODP.NET Types), 17 of 19


OracleRefCursor Class

An OracleRefCursor object represents an Oracle REF CURSOR.

Class Inheritance

Object

  MarshalRefByObject

    OracleRefCursor

Declaration
// C#
public sealed class OracleRefCursor : MarshalRefByObject, IDisposable
Thread Safety

All public static methods are thread-safe, although instance methods do not guarantee thread safety.

Example
// 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);
...

Requirements

Namespace: Oracle.DataAccess.Types

Assembly: Oracle.DataAccess.dll

See Also:

OracleRefCursor Members

OracleRefCursor members are listed in the following tables:

OracleRefCursor Static Methods

OracleRefCursor static methods are listed in Table 5-174.

Table 5-174 OracleRefCursor Static Methods  
Methods Description

Equals

Inherited from Object (Overloaded)

OracleRefCursor Properties

OracleRefCursor properties are listed in Table 5-175.

Table 5-175 OracleRefCursor Properties  
Properties Description

Connection

A reference to the OracleConnection used to fetch the REF CURSOR data

OracleRefCursor Instance Methods

OracleRefCursor instance methods are listed in Table 5-176.

Table 5-176 OracleRefCursor Instance Methods  
Methods Description

Dispose

Disposes the resources allocated by the OracleRefCursor object

Equals

Inherited from Object (Overloaded)

GetDataReader

Returns an OracleDataReader object for the REF CURSOR

GetHashCode

Inherited from Object

GetType

Inherited from Object

ToString

Inherited from Object

See Also:

OracleRefCursor Static Methods

OracleRefCursor static methods are listed in Table 5-177.

Table 5-177 OracleRefCursor Static Methods  
Methods Description

Equals

Inherited from Object (Overloaded)

See Also:

OracleRefCursor Properties

OracleRefCursor properties are listed in Table 5-178.

Table 5-178 OracleRefCursor Properties  
Properties Description

Connection

A reference to the OracleConnection used to fetch the REF CURSOR data

See Also:

Connection

This property refers to the OracleConnection used to fetch the REF CURSOR data.

Declaration
// C#
public OracleConnection Connection {get;}
Property Value

An OracleConnection.

Exceptions

ObjectDisposedException - The object is already disposed.

Remarks

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.

See Also:

OracleRefCursor Instance Methods

OracleRefCursor instance methods are listed in Table 5-179.

Table 5-179 OracleRefCursor Instance Methods  
Methods Description

Dispose

Disposes the resources allocated by the OracleRefCursor object

Equals

Inherited from Object (Overloaded)

GetDataReader

Returns an OracleDataReader object for the REF CURSOR

GetHashCode

Inherited from Object

GetType

Inherited from Object

ToString

Inherited from Object

See Also:

Dispose

This instance method disposes of the resources allocated by the OracleRefCursor object.

Declaration
// C#
public void Dispose();
Implements

IDisposable

Remarks

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.

See Also:

GetDataReader

This instance method returns an OracleDataReader object for the REF CURSOR.

Declaration
// C#
public OracleDataReader GetDataReader();
Return Value

OracleDataReader

Remarks

Using the OracleDataReader, rows can be fetched from the REF CURSOR.

See Also:


Go to previous page Go to beginning of chapter Go to next page
Oracle
Copyright © 2002, 2003 Oracle Corporation.

All Rights Reserved.
Go To Table Of Contents
Contents
Go To Index
Index