Hi everyone,
I want to create a temporary clob. That's my function:
public static OracleLob CreateTemporaryClob(OracleConnection conn, OracleTransaction tx, string data)
{
    OracleLob tempClob = null;
    byte[] bData = new System.Text.ASCIIEncoding().GetBytes(data);
    string cmdText = "declare a clob; begin dbms_lob.createtemporary(a, false); :tempclob := a; end;";    
    OracleCommand cmd = new OracleCommand(cmdText, conn);
    cmd.Transaction = tx;
    OracleParameter p = cmd.Parameters.Add("tempclob", OracleType.Clob);
    p.Direction = ParameterDirection.Output;
    cmd.ExecuteNonQuery();
    tempClob = (OracleLob)p.Value;
    tempClob.BeginBatch(OracleLobOpenMode.ReadWrite);
    tempClob.Write(bData, 0, bData.Length);  // <= ERROR
    tempClob.EndBatch();
    return tempClob;
}
And everthing seems to work fine with short input strings. But if I pass string which are bigger than about 4k I always get this error in the marked line:
CLOB and NCLOB require even number of bytes for this argument. Parameter name: count
The size of the variables are: bData = byte[6820]; bData.Length = 6820;
Thx 4 answers.