日本語PDF

OracleClobクラス

OracleClobは、CLOBデータへの参照が含まれるオブジェクトです。このオブジェクトは、CLOBに対して操作を実行するためのメソッドを提供します。

注意:

OracleClobオブジェクトでは、.NET Frameworkバイト配列を使用したCLOBデータの取得または書込み時に、クライアント側のキャラクタ・セットが使用されます。

クラスの継承

System.Object

  System.MarshalByRefObject

    System.IO.Stream

      Oracle.DataAccess.Types.OracleClob

宣言

// C#
public sealed class OracleClob : Stream, ICloneable, INullable

要件

プロバイダ ODP.NET管理対象外ドライバ ODP.NET管理対象ドライバ ODP.NET Core

アセンブリ

Oracle.DataAccess.dll

Oracle.ManagedDataAccess.dll

Oracle.ManagedDataAccess.dll

ネームスペース

Oracle.DataAccess.Client

Oracle.ManagedDataAccess.Client

Oracle.ManagedDataAccess.Client

.NET Framework

3.5, 4.5, 4.6, 4.7

4.5, 4.6, 4.7

4.6.1以降

.NET Core

-

-

2.1以降

スレッド安全性

パブリック静的メソッドはスレッドセーフですが、インスタンス・メソッドではスレッド安全性は保証されません。

// C#
 
using System;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
 
class OracleClobSample
{
  static void Main()
  {
    string constr = "User Id=scott;Password=tiger;Data Source=oracle";
    OracleConnection con = new OracleConnection(constr);
    con.Open();
 
    OracleClob clob = new OracleClob(con);        
 
    // Write 4 chars from writeBuffer, starting at buffer offset 0
    char[] writeBuffer = new char[4] {'a', 'b', 'c', 'd'};
    clob.Write(writeBuffer, 0, 4);
 
    // Append first 2 chars from writeBuffer {'a', 'b'} to the oracleClob
    clob.Append(writeBuffer, 0, 2);
 
    // Prints "clob.Length  = 12"
    Console.WriteLine("clob.Length  = " + clob.Length);
 
    // Reset the Position for the Read
    clob.Position = 0;
 
    // Read 6 chars into readBuffer, starting at buffer offset 0
    char[] readBuffer = new char[6];       
    int charsRead = clob.Read(readBuffer, 0, 6);
 
    // Prints "charsRead    = 6"
    Console.WriteLine("charsRead    = " + charsRead);    
 
    // Prints "readBuffer   = abcdab"
    Console.Write("readBuffer   = ");
    for(int index = 0; index <  readBuffer.Length; index++)
    {
      Console.Write(readBuffer[index]);
    }
    Console.WriteLine();
        
    // Search for the 2nd occurrence of a char pattern 'ab'
    // starting from char offset 0 in the OracleClob
    char[] pattern = new char[2] {'a', 'b'};
    long posFound = clob.Search(pattern, 0, 2);
 
    // Prints "posFound     = 5" 
    Console.WriteLine("posFound     = " + posFound);          
      
    // Erase 4 chars of data starting at char offset 1
    // Sets chars to ''
    clob.Erase(1, 4);
 
    //Prints "clob.Value   = a    b"
    Console.WriteLine("clob.Value   = " + clob.Value);
 
    clob.Close();
    clob.Dispose();
 
    con.Close();
    con.Dispose();
  }
}