Please note that CLOB contains a sequence of bytes from the encoded string. Thus, under debug you see these bytes, not the string itself in the CLOB value. To retrieve the string from CLOB you should get a byte array and then decode it, as it is shown in the following sample:
Code: Select all
// Set encoding to Unicode.
var encoding = new System.Text.UnicodeEncoding();
OracleLob oracleLob = new OracleLob(OracleDbType.Clob);
// Encode the string.
var arrData = encoding.GetBytes(pData);
// Check that string can be decoded properly.
string s = new string(encoding.GetChars(arrData));
Console.WriteLine(s);
// Populate CLOB.
oracleLob.Write(arrData, 0, arrData.Length);
// Retrieve the string from CLOB, check that it is decoded properly.
oracleLob.Read(arrData, 0, arrData.Length);
s = new string(encoding.GetChars(arrData));
Console.WriteLine(s);
Feel free to contact us if something is unclear.