プライマリ・コンテンツに移動
Oracle® Data Provider for .NET開発者ガイド
ODAC 12.2c リリース1 (12.2.0.1) for Microsoft Windows
E88311-03
目次へ移動
目次
索引へ移動
索引

前
次

Write(char[ ], int, int)

このインスタンス・メソッドでは、指定された文字配列バッファからOracleClobにデータを書き込みます。

宣言

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

パラメータ

  • buffer

    OracleClobに書き込まれた文字配列バッファ

  • offset

    bufferの読取り元のオフセット(文字)

  • count

    OracleClobに書き込まれるバッファ数(文字)

例外

ObjectDisposedException - オブジェクトはすでに処理されています。

InvalidOperationException - OracleConnectionがオープンされていないか、またはオブジェクトの存続中にクローズされています。

ArgumentOutOfRangeException - この例外は次のいずれかの条件が存在する場合に表示されます。

  • offsetまたはcount0未満の場合

  • offsetbuffer.Length以上である場合

  • offsetおよびcountの合計がbuffer.Lengthより大きい場合

  • Positionが偶数でない場合

備考

すべてのCLOBおよびNCLOBデータをUnicodeとして処理します。

LOBデータの読取りは、Positionプロパティにより指定された位置から開始されます。

必要に応じて、クライアント・キャラクタ・セットからデータベース・キャラクタ・セットに適切なデータ変換が行われます。

// C#
 
using System;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
 
class WriteSample
{
  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);
      
    // Set the Position for the Write;
    clob.Position = 0;
 
    // Begin ChunkWrite to improve performance
    // Index updates occur only once after EndChunkWrite
    clob.BeginChunkWrite();         
      
    // Write to the OracleClob in 5 chunks of 2 chars each
    char[] c = new char[2] {'a', 'b'};
    for (int index = 0; index < 5; index++)
    {
      clob.Write(c, 0, c.Length);
    }
    clob.EndChunkWrite();
 
    // Prints "clob.Value = ababababab"
    Console.WriteLine("clob.Value = " + clob.Value);
 
    clob.Close();
    clob.Dispose();
 
    con.Close();
    con.Dispose();
  }
}