Export (0) Print
Expand All

OracleLob.SetLength Method

Sets the length of the OracleLob stream to a value less than the current length.

Namespace:  System.Data.OracleClient
Assembly:  System.Data.OracleClient (in System.Data.OracleClient.dll)

public override void SetLength(
	long value
)

Parameters

value
Type: System.Int64

The desired length of the current OracleLob stream in bytes. For CLOB and NCLOB data types, this must be an even number.

ExceptionCondition
ArgumentOutOfRangeException

A value specified in the value parameter for a CLOB or NCLOB data type is not even.

-or-

A value specified in the value parameter is less than zero or greater than 4 gigabytes.

InvalidOperationException

The operation is not within a transaction, the OracleLob object is null, or the connection is closed.

ObjectDisposedException

The object was closed or disposed.

OracleException

An Oracle error has occurred.

An attempt to increase the length of the OracleLob stream fails, and returns "Message: ORA-22926: specified trim length is greater than current LOB value's length" from the Oracle server.

A stream must support both writing and seeking for SetLength to function.

The .NET Framework Data Provider for Oracle handles all CLOB and NCLOB data as Unicode. Therefore, when accessing CLOB and NCLOB data types, you are always dealing with the number of bytes, where each character is 2 bytes. For example, if a string of text containing three characters is saved as an NCLOB on an Oracle server where the character set is 4 bytes per character, and you perform a SetLength operation, you specify the length of the string as 6 bytes, although it is stored as 12 bytes on the server.

To write to the LOB, you must have retrieved the LOB using the FOR UPDATE clause in the SQL SELECT statement, and you must have a local transaction started.

NoteNote:

A write operation to a read-only LOB might succeed, but does not update the LOB on the server. In this case, however, the local copy of the LOB is updated. Therefore, later read operations on the OracleLob object might return the results of the write operation.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1

Community Additions

ADD
Show:
© 2014 Microsoft