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), 16 of 19


OracleClob Class

An OracleClob is an object that has a reference to CLOB data. It provides methods for performing operations on CLOBs.


Note:

The OracleClob object uses the client side character set when retrieving or writing CLOB data using a .NET Framework byte array.


Class Inheritance

Object

  MarshalByRefObject

    Stream

      OracleClob

Declaration
// C#
public sealed class OracleClob : Stream, ICloneable
Thread Safety

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

Example
// C#
// Example demostrates Read, Append, Search, Write and, Erase APIs 
// assume: A valid connection 'con'is created
OracleClob oraClob = new OracleClob(con);

// Read some data (in characters)
char buffer = new char[1024];
int  bufferOffset  = 10;
int  amountToBeRead = 10;

int charRead = oraClob.Read(buffer, bufferOffset, amountToBeRead);

// Search for the 2nd occurrence of a char pattern 'oracle'
// from the oraClob starting at offset 1
char[6] pattern = new char[6] { "o", "r", "a", "c", "l", "e" };
int positionFound = oraClob.Search(pattern, 1, 2);

// Append 2 char to the oraClob
oraClob.Append(new char[3] {"f", "o", "o"}, 1, 2);

// Write 32 char, starting at buffer offset 512
char[4096] buffer = new char[4096];
...
oraClob.Write(buffer, 512, 32);

// Erase 64 char of data starting at offset=1024
oraClob.Erase(1024,64);
...

Requirements

Namespace: Oracle.DataAccess.Types

Assembly: Oracle.DataAccess.dll

See Also:

OracleClob Members

OracleClob members are listed in the following tables:

OracleClob Constructors

OracleClob constructors are listed in Table 5-165.

Table 5-165 OracleClob Constructors  
Constructor Description

OracleClob Constructors

Creates an instance of the OracleClob class bound to a temporary CLOB (Overloaded)

OracleClob Static Fields

OracleClob static fields are listed in Table 5-166.

Table 5-166 OracleClob Static Fields  
Field Description

MaxSize

Holds the maximum number of bytes a CLOB can hold, which is 4,294,967,295 (2^32 - 1) bytes

OracleClob Static Methods

OracleClob static methods are listed in Table 5-167.

Table 5-167 OracleClob Static Methods  
Methods Description

Equals

Inherited from Object (Overloaded)

OracleClob Instance Properties

OracleClob instance properties are listed in Table 5-168.

Table 5-168 OracleClob Instance Properties  
Properties Description

CanRead

Indicates whether the LOB stream can be read

CanSeek

Indicates whether forward and backward seek operations can be performed

CanWrite

Indicates whether the LOB stream can be written

Connection

Indicates the OracleConnection that is used to retrieve and write CLOB data

IsEmpty

Indicates whether the CLOB is empty or not

IsInChunkWriteMode

Indicates whether or not the CLOB has been opened

IsNCLOB

Indicates whether the OracleClob object represents an NCLOB.

IsTemporary

Indicates whether or not the current instance is bound to a temporary CLOB

Length

Indicates the size of the CLOB data in bytes

OptimumChunkSize

Indicates the minimum number of bytes to retrieve or send from the server during a read or write operation

Position

Indicates the current read or write position in the LOB stream in bytes

Value

Returns the data, starting from the first character in the CLOB or NCLOB, as a string

OracleClob Instance Methods

The OracleClob instance methods are listed in Table 5-169.

.
Table 5-169 OracleClob Instance Methods  
Methods Description

Append

Appends data to the current OracleClob instance (Overloaded)

BeginChunkWrite

Opens the CLOB

BeginRead

Inherited from Stream

BeginWrite

Inherited from Stream

Clone

Creates a copy of an OracleClob object

Close

Closes the current stream and releases resources associated with it

Compare

Compares data referenced by the current instance to that of the supplied object

CopyTo

Copies the data to an OracleClob (Overloaded)

CreateObjRef

Inherited from MarshalByRefObject

Dispose

Releases resources allocated by this object

EndChunkWrite

Closes the CLOB referenced by the current OracleClob instance

EndRead

Inherited from Stream

EndWrite

Inherited from Stream

Equals

Inherited from Object (Overloaded)

Erase

Erases the specified amount of data (Overloaded)

Flush

Not supported

GetHashCode

Returns a hash code for the current instance

GetLifetimeService

Inherited from MarshalByRefObject

GetType

Inherited from Object

InitializeLifetimeService

Inherited from MarshalByRefObject

IsEqual

Compares the LOB data referenced by two OracleClobs

Read

Reads from the current instance (Overloaded)

ReadByte

Inherited from Stream

Search

Searches for a character pattern in the current instance of OracleClob (Overloaded)

Seek

Sets the position in the current LOB stream

SetLength

Trims or truncates the CLOB value

ToString

Inherited from Object

Write

Writes the provided buffer into the OracleClob (Overloaded)

WriteByte

Inherited from Stream

See Also:

OracleClob Constructors

OracleClob constructors create instances of the OracleClob class bound to a temporary CLOB.

Overload List:

OracleClob(OracleConnection)

This constructor creates an instance of the OracleClob class bound to a temporary CLOB with an OracleConnection object.

Declaration
// C#
public OracleClob(OracleConnection con);
Parameters
Exceptions

InvalidOperationException - The OracleConnection is not open or has been closed during the lifetime of the object.

Remarks

The connection must be opened explicitly by the application. OracleClob does not open the connection implicitly. The temporary CLOB utilizes the provided connection to store CLOB data. Caching is not enabled by default.

See Also:

OracleClob(OracleConnection, bool, bool)

This constructor creates an instance of the OracleClob class that is bound to a temporary CLOB, with an OracleConnection object, a boolean value for caching, and a boolean value for NCLOB.

Declaration
// C#
public OracleClob(OracleConnection con, bool bCaching, bool bNCLOB);
Parameters
Exceptions

InvalidOperationException - The OracleConnection is not open or has been closed during the lifetime of the object.

Remarks

The connection must be opened explicitly by the application. OracleClob does not open the connection implicitly. The temporary CLOB or NCLOB uses the provided connection to store CLOB data.

See Also:

OracleClob Static Fields

OracleClob static fields are listed in Table 5-170.

Table 5-170 OracleClob Static Fields  
Field Description

MaxSize

Holds the maximum number of bytes a CLOB can hold, which is 4,294,967,295 (2^32 - 1) bytes

See Also:

MaxSize

The MaxSize field holds the maximum number of bytes a CLOB can hold, which is 4,294,967,295 (2^32 - 1) bytes.

Declaration
// C#
public static readonly Int64 MaxSize = 4294967295;
Remarks

This field is useful in code that checks whether your operation exceeds the maximum length (in bytes) allowed.

See Also:

OracleClob Static Methods

OracleClob static methods are listed in Table 5-171.

Table 5-171 OracleClob Static Methods  
Methods Description

Equals

Inherited from Object (Overloaded)

See Also:

OracleClob Instance Properties

OracleClob instance properties are listed in Table 5-172.

Table 5-172 OracleClob Instance Properties  
Properties Description

CanRead

Indicates whether the LOB stream can be read

CanSeek

Indicates whether forward and backward seek operations can be performed

CanWrite

Indicates whether the LOB stream can be written

Connection

Indicates the OracleConnection that is used to retrieve and write CLOB data

IsEmpty

Indicates whether the CLOB is empty or not

IsInChunkWriteMode

Indicates whether or not the CLOB has been opened

IsNCLOB

Indicates whether the OracleClob object represents an NCLOB.

IsTemporary

Indicates whether or not the current instance is bound to a temporary CLOB

Length

Indicates the size of the CLOB data in bytes

OptimumChunkSize

Indicates the minimum number of bytes to retrieve or send from the server during a read or write operation

Position

Indicates the current read or write position in the LOB stream in bytes

Value

Returns the data, starting from the first character in the CLOB or NCLOB, as a string

See Also:

CanRead

Overrides Stream

This instance property indicates whether the LOB stream can be read.

Declaration
// C#
public override bool CanRead{get;}
Property Value

If the LOB stream can be read, returns true; otherwise, returns false.

See Also:

CanSeek

Overrides Stream

This instance property indicates whether forward and backward seek operations can be performed.

Declaration
// C#
public override bool CanSeek{get;}
Property Value

If forward and backward seek operations can be performed, returns true; otherwise, returns false.

See Also:

CanWrite

Overrides Stream

This instance property indicates whether the LOB object supports writing.

Declaration
// C#
public override bool CanWrite{get;}
Property Value

If the LOB stream can be written, returns true; otherwise, returns false.

See Also:

Connection

This instance property indicates the OracleConnection that is used to retrieve and write CLOB data.

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

An OracleConnection.

Exceptions

ObjectDisposedException - The object is already disposed.

See Also:

IsEmpty

This instance property indicates whether the CLOB is empty or not.

Declaration
// C#
public bool IsEmpty {get;}
Property Value

A bool.

Exceptions

ObjectDisposedException - The object is already disposed.

See Also:

IsInChunkWriteMode

This instance property indicates whether the CLOB has been opened to defer index updates.

Declaration
// C#
public bool IsInChunkWriteMode{get;}
Property Value

If the CLOB has been opened, returns true; otherwise, returns false.

See Also:

IsNCLOB

This instance property indicates whether the OracleClob object represents an NCLOB.

Declaration
// C#
public bool IsNCLOB {get;}
Property Value

A bool.

See Also:

IsTemporary

This instance property indicates whether or not the current instance is bound to a temporary CLOB.

Declaration
// C#
public bool IsTemporary {get;}
Property Value

A bool.

See Also:

Length

Overrides Stream

This instance property indicates the size of the CLOB data in bytes.

Declaration
// C#
public override Int64 Length {get;}
Property Value

An Int64 that indicates the size of the CLOB in bytes.

Exceptions

ObjectDisposedException - The object is already disposed.

InvalidOperationException - The OracleConnection is not open or has been closed during the lifetime of the object.

See Also:

OptimumChunkSize

This instance property indicates the minimum number of bytes to retrieve or send from the server during a read or write operation.

Declaration
// C#
public int OptimumChunkSize{get;}
Property Value

A number representing the minimum bytes to retrieve or send.

Exceptions

ObjectDisposedException - The object is already disposed.

See Also:

Position

Overrides Stream

This instance property indicates the current read or write position in the LOB stream in bytes.

Declaration
// C#
public override Int64 Position{get; set;}
Property Value

An Int64 that indicates the read or write position.

Exceptions

ObjectDisposedException - The object is already disposed.

InvalidOperationException - The OracleConnection is not open or has been closed during the lifetime of the object.

ArgumentOutOfRangeException - The Position is less than 0.

See Also:

Value

This instance property returns the data, starting from the first character in the CLOB or NCLOB, as a string.

Declaration
// C#
public string Value{get;}
Property Value

A string.

Exceptions

ObjectDisposedException - The object is already disposed.

InvalidOperationException - The OracleConnection is not open or has been closed during the lifetime of the object.

ArgumentOutOfRangeException - The Value is less than 0.

Remarks

The value of Position is neither used nor changed by using this property.

The maximum string length that can be returned by this property is 2 GB.

See Also:

OracleClob Instance Methods

The OracleClob instance methods are listed in Table 5-173.

Table 5-173 OracleClob Instance Methods  
Methods Description

Append

Appends data to the current OracleClob instance (Overloaded)

BeginChunkWrite

Opens the CLOB

BeginRead

Inherited from Stream

BeginWrite

Inherited from Stream

Clone

Creates a copy of an OracleClob object

Close

Closes the current stream and releases resources associated with it

Compare

Compares data referenced by the current instance to that of the supplied object

CopyTo

Copies the data to an OracleClob (Overloaded)

CreateObjRef

Inherited from MarshalByRefObject

Dispose

Releases resources allocated by this object

EndChunkWrite

Closes the CLOB referenced by the current OracleClob instance

EndRead

Inherited from Stream

EndWrite

Inherited from Stream

Equals

Inherited from Object (Overloaded)

Erase

Erases the specified amount of data (Overloaded)

Flush

Not supported

GetHashCode

Returns a hash code for the current instance

GetLifetimeService

Inherited from MarshalByRefObject

GetType

Inherited from Object

InitializeLifetimeService

Inherited from MarshalByRefObject

IsEqual

Compares the LOB data referenced by two OracleClobs

Read

Reads from the current instance (Overloaded)

ReadByte

Inherited from Stream

Search

Searches for a character pattern in the current instance of OracleClob (Overloaded)

Seek

Sets the position in the current LOB stream

SetLength

Trims or truncates the CLOB value

ToString

Inherited from Object

Write

Writes the provided buffer into the OracleClob (Overloaded)

WriteByte

Inherited from Stream

See Also:

Append

This instance method appends data to the current OracleClob instance.

Overload List:

Append(OracleClob)

This instance method appends the CLOB data referenced by the provided OracleClob object to the current OracleClob instance.

Declaration
// C#
public void Append(OracleClob obj);
Parameters
Exceptions

ObjectDisposedException - The object is already disposed.

InvalidOperationException - The parameter has a different connection than the object, OracleConnection is not opened, or OracleConnection has been reopened.

Remarks

No character set conversions are made.

The provided object and the current instance must be using the same connection; that is, the same OracleConnection object.

See Also:

Append(byte [ ], int, int)

This instance method appends data at the end of the CLOB, from the supplied byte array buffer, starting from offset (in bytes) of the supplied byte array buffer.

Declaration
// C#
public int Append(byte[] buffer, int offset, int count);
Parameters
Exceptions

ObjectDisposedException - The object is already disposed.

InvalidOperationException - The OracleConnection is not open or has been closed during the lifetime of the object.

ArgumentOutOfRangeException - Either the offset or the count parameter is not even.

Remarks

Both offset and count must be even numbers for CLOB and NCLOB because every two bytes represent a Unicode character.

See Also:

Append(char [ ], int, int)

This instance method appends data from the supplied character array buffer to the end of the current OracleClob instance, starting at the offset (in characters) of the supplied character buffer.

Declaration
// C#
public void Append(char[] buffer, int offset, int count);
Parameters
Exceptions

ObjectDisposedException - The object is already disposed.

InvalidOperationException - The OracleConnection is not open or has been closed during the lifetime of the object.

Example
// C#
...
// Append 2 char to the oraClob
oraClob.Append(new char[3] {"f", "o", "o"}, 1, 2);
...

See Also:

BeginChunkWrite

This instance method opens the CLOB.

Declaration
// C#
public void BeginChunkWrite();
Exceptions

ObjectDisposedException - The object is already disposed.

InvalidOperationException - The OracleConnection is not open or has been closed during the lifetime of the object.

Remarks

BeginChunkWrite does not need to be called before manipulating the CLOB data. This is provided for performance reasons.

After this method is called, write operations do not cause the domain or function-based index on the column to be updated. Index updates occur only once after EndChunkWrite is called.

See Also:

Clone

This instance method creates a copy of an OracleClob object.

Declaration
// C#
public object Clone();
Return Value

An OracleClob object.

Implements

ICloneable

Exceptions

ObjectDisposedException - The object is already disposed.

InvalidOperationException - The OracleConnection is not open or has been closed during the lifetime of the object.

Remarks

The cloned object has the same property values as that of the object being cloned.

Example
// C#
...
//Need a proper casting for the return value when cloned
OracleClob oraClob_cloned = (OracleClob) oraClob.Clone();
...

See Also:

Close

Overrides Stream

This instance method closes the current stream and releases resources associated with it.

Declaration
// C#
public override void Close();

See Also:

Compare

This instance method compares data referenced by the current instance to that of the supplied object.

Declaration
// C#
public int Compare(Int64 src_offset, OracleClob obj, Int64 dst_offset, 
  Int64 amount);
Parameters
Return Value

The method returns a value that is:

Exceptions

ObjectDisposedException - The object is already disposed.

InvalidOperationException - The parameter has a different connection than the object, OracleConnection is not opened, or OracleConnection has been reopened.

ArgumentOutOfRangeException - Either the src_offset, dst_offset, or amount parameter is less than 0.

Remarks

The character set of the two OracleClob objects being compared should be the same for a meaningful comparison.

The provided object and the current instance must be using the same connection, that is, the same OracleConnection object.

See Also:

CopyTo

CopyTo copies data from the current instance to the provided OracleClob object.

Overload List:

CopyTo(OracleClob)

This instance method copies data from the current instance to the provided OracleClob object.

Declaration
// C#
public Int64 CopyTo(OracleClob obj);
Parameters
Return Value

The return value is the amount copied.

Exceptions

ObjectDisposedException - The object is already disposed.

InvalidOperationException - This exception is thrown if any of the following conditions exist:

Remarks

The provided object and the current instance must be using the same connection, that is, the same OracleConnection object.

See Also:

CopyTo(OracleClob, Int64)

This instance method copies data from the current OracleClob instance to the provided OracleClob object with the specified destination offset.

Declaration
// C#
public Int64 CopyTo(OracleClob obj, Int64 dst_offset);
Parameters
Return Value

The return value is the amount copied.

Exceptions

ObjectDisposedException - The object is already disposed.

ArgumentOutOfRangeException - The dst_offset is less than 0.

InvalidOperationException - This exception is thrown if any of the following conditions exist:

Remarks

If the dst_offset is beyond the end of the OracleClob data, spaces are written into the OracleClob until the dst_offset is met.

The offsets are 0-based. No character conversion is performed by this operation.

The provided object and the current instance must be using the same connection; that is, the same OracleConnection object.

See Also:

CopyTo(Int64, OracleClob, Int64, Int64)

This instance method copies data from the current OracleClob instance to the provided OracleClob object with the specified source offset, destination offset, and character amounts.

Declaration
// C#
public Int64 CopyTo(Int64 src_offset,OracleClob obj,Int64 dst_offset,Int64 
amount);
Parameters
Return Value

The return value is the amount copied.

Exceptions

ObjectDisposedException - The object is already disposed.

InvalidOperationException - The parameter has a different connection than the object, OracleConnection is not opened, or OracleConnection has been reopened.

ArgumentOutOfRangeException - The src_offset, the dst_offset, or the amount parameter is less than 0.

Remarks

If the dst_offset is beyond the end of the OracleClob data, spaces are written into the OracleClob until the dst_offset is met.

The offsets are 0-based. No character conversion is performed by this operation.

The provided object and the current instance must be using the same connection, that is, the same OracleConnection object.

Example
// C#
...
// Assume you have a valid connection 'con'
OracleClob src_clob = new OracleClob(con);
OracleClob target_clob = new OracleClob(con);

// Copy 1024 chars from src_clob (begin at offset 10) to target_blob
// (starting at offset 5)
src_clob.CopyTo(10, target_clob, 5, 1024);
...

See Also:

Dispose

This instance method releases resources allocated by this object.

Declaration
public void Dispose();
Implements

IDisposable

Remarks

The object cannot be reused after being disposed. Although some properties can still be accessed, their values cannot be accountable. Since resources are freed, method calls can lead to exceptions.

See Also:

EndChunkWrite

This instance method closes the CLOB referenced by the current OracleClob instance.

Declaration
// C#
public void EndChunkWrite();
Exceptions

ObjectDisposedException - The object is already disposed.

InvalidOperationException - The OracleConnection is not open or has been closed during the lifetime of the object.

Remarks

Index updates occur immediately if write operation(s) are deferred by the BeginChunkWrite method.

See Also:

Erase

Erase erases part or all data.

Overload List:

Erase()

This instance method erases all data.

Declaration
// C#
public Int64 Erase();
Return Value

The number of characters erased.

See Also:

Erase(Int64, Int64)

This instance method replaces the specified amount of data (in characters) starting from the specified offset with zero-byte fillers (in characters).

Declaration
// C#
public Int64 Erase(Int64 offset, Int64 amount);
Parameters
Return Value

The actual number of characters erased.

Exceptions

ObjectDisposedException - The object is already disposed.

InvalidOperationException - The OracleConnection is not open or has been closed during the lifetime of the object.

ArgumentOutOfRangeException - The offset or amount parameter is less than 0.

See Also:

GetHashCode

Overrides Object

This method returns a hash code for the current instance.

Declaration
// C#
public override int GetHashCode();
Return Value

An int representing a hash code.

See Also:

IsEqual

This instance method compares the LOB data referenced by two OracleClobs.

Declaration
// C#
public bool IsEqual(OracleClob obj);
Parameters
Return Value

Returns true if the current OracleClob and the provided OracleClob refer to the same LOB. Otherwise, returns false.

Remarks

Note that this method can return true even if the two OracleClob objects returns false for == or Equals() because two different OracleClob instances can refer to the same LOB.

The provided object and the current instance must be using the same connection, that is, the same OracleConnection object.

See Also:

Read

Read reads a specified amount from the current instance and populates the array buffer.

Overload List:

Read(byte [ ], int, int)

Overrides Stream

This instance method reads a specified amount of bytes from the current instance and populates the byte array buffer.

Declaration
// C#
public override int Read(byte [ ] buffer, int offset, int count);
Parameters
Return Value

The number of bytes read from the CLOB.

Exceptions

ObjectDisposedException - The object is already disposed.

InvalidOperationException - The OracleConnection is not open or has been closed during the lifetime of the object.

Remarks

Both offset and count must be even numbers for CLOB and NCLOB because every two bytes represent a Unicode character.

The LOB data is read starting from the position specified by the Position property, which must also be an even number.

OracleClob is free to return fewer bytes than requested, even if the end of the stream has not been reached.

See Also:

Read(char [ ], int, int)

This instance method reads a specified amount of characters from the current instance and populates the character array buffer.

Declaration
// C#
public int Read(char[ ] buffer, int offset, int count);
Parameters
Return Value

The return value indicates the number of characters read from the CLOB.

Exceptions

ObjectDisposedException - The object is already disposed.

InvalidOperationException - The OracleConnection is not open or has been closed during the lifetime of the object.

ArgumentOutOfRangeException - This exception is thrown if any of the following conditions exist:

Remarks

Handles all CLOB and NCLOB data as Unicode.

The LOB data is read starting from the position specified by the Position property.

Example
// C#
...
// Read some data (in characters)
char buffer = new char[1024];
int  bufferOffset  = 10;
int amountToBeRead = 10;

int charRead = oraClob.Read(buffer, bufferOffset, amountToBeRead);
...

See Also:

Search

Search searches for a character pattern in the current instance of OracleClob.

Overload List:

Search(byte[ ], Int64, Int64)

This instance method searches for a character pattern, represented by the byte array, in the current instance of OracleClob.

Declaration
// C#
public int Search(byte[ ] val, Int64 offset, Int64 nth);
Parameters
Return Value

Returns the absolute offset of the start of the matched pattern (in bytes) for the nth occurrence of the match. Otherwise, 0 is returned.

Exceptions

ObjectDisposedException - The object is already disposed.

InvalidOperationException - The OracleConnection is not open or has been closed during the lifetime of the object.

ArgumentOutOfRangeException - This exception is thrown if any of the following conditions exist:

Remarks

The byte[ ] is converted to Unicode before the search is made.

The limit of the search pattern is 16383 bytes.

See Also:

Search(char[ ], Int64, Int64)

This instance method searches for a character pattern in the current instance of OracleClob.

Declaration
// C#
public Int64 Search(char [ ] val, Int64 offset, Int64 nth);
Parameters
Return Value

Returns the absolute offset of the start of the matched pattern (in characters) for the nth occurrence of the match. Otherwise, 0 is returned.

Exceptions

ObjectDisposedException - The object is already disposed.

InvalidOperationException - The OracleConnection is not open or has been closed during the lifetime of the object.

ArgumentOutOfRangeException - This exception is thrown if any of the following conditions exist:

Remarks

The limit of the search pattern is 16383 bytes.

Examples
// C#
..
// Search for the 2nd occurrence of a char pattern 'oracle'
// from the oraClob starting at offset 1
char[6] pattern = new char[6] { "o", "r", "a", "c", "l", "e" };
int positionFound = oraClob.Search(pattern, 1, 2);
...

See Also:

Seek

Overrides Stream

This instance method sets the position on the current LOB stream.

Declaration
// C#
public override Int64(Int64 offset, SeekOrigin origin);
Parameters
Return Value

Returns an Int64 that indicates the position.

Exceptions

ObjectDisposedException - The object is already disposed.

InvalidOperationException - The OracleConnection is not open or has been closed during the lifetime of the object.

Remarks

If offset is negative, the new position precedes the position specified by origin by the number of characters specified by offset.

If offset is zero, the new position is the position specified by origin.

If offset is positive, the new position follows the position specified by origin by the number of characters specified by offset.

SeekOrigin.Begin specifies the beginning of a stream.

SeekOrigin.Current specifies the current position within a stream.

SeekOrigin.End specifies the end of a stream.

See Also:

SetLength

Overrides Stream

This instance method trims or truncates the CLOB value to the specified length (in characters).

Declaration
// C#
public override void SetLength(Int64 newlen);
Parameters
Exceptions

ObjectDisposedException - The object is already disposed.

InvalidOperationException - The OracleConnection is not open or has been closed during the lifetime of the object.

ArgumentOutOfRangeException - The newlen parameter is greater than 0.

See Also:

Write

This instance method writes data from the provided array buffer into the OracleClob.

Overload List:

Write(byte[ ], int, int)

Overrides Stream

This instance method writes data from the provided byte array buffer into the OracleClob.

Declaration
// C#
public override void Write(byte[ ] buffer, int offset, int count);
Parameters
Exceptions

ObjectDisposedException - The object is already disposed.

InvalidOperationException - The OracleConnection is not open or has been closed during the lifetime of the object.

ArgumentOutOfRangeException - This exception is thrown if any of the following conditions exist:

Remarks

Both offset and count must be even numbers for CLOB and NCLOB because every two bytes represent a Unicode character.

The LOB data is read starting from the position specified by the Position property. The Position property must be an even number.

If necessary, proper data conversion is carried out from the client character set to the database character set.

See Also:

Write(char[ ], int, int)

This instance method writes data from the provided character array buffer into the OracleClob.

Declaration
// C#
public void Write(char[ ] buffer, int offset, int count);
Parameters
Exceptions

ObjectDisposedException - The object is already disposed.

InvalidOperationException - The OracleConnection is not open or has been closed during the lifetime of the object.

ArgumentOutOfRangeException - This exception is thrown if any of the following conditions exist:

Remarks

Handles all CLOB and NCLOB data as Unicode.

The LOB data is read starting from the position specified by the Position property.

If necessary, proper data conversion is carried out from the client character set to the database character set.

Example
// C#
...
// Begin ChunkWrite to improve performance
// Index updates occur only once after EndChunkWrite
oraClob.BeginChunkWrite();

// Set the write from the beginning;
oraClob.Position = 0;

// Write to the oraClob in chunks of 10, each 1024 char
for ( int i=0; i<10; i++ )
 {
   char[1024] c;
   c = c[0]= a;    // some new value to be written
   oraClob.Write(c, 0, c.Length);
 }

oraClob.EndChunkWrite();
...

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