using (OracleConnection conn =A quick walkthrough of the code...
new OracleConnection(connectionString))
{
conn.Open();
OracleTransaction tx = conn.BeginTransaction();
OracleCommand cmdLob = new OracleCommand(
String.Format("SELECT NCLOB_FIELD FROM MYTABLE WHERE " +
"PK = {0} FOR UPDATE", pk), conn, tx);
cmdLob.CommandType = CommandType.Text;
using (OracleDataReader dr = cmdLob.ExecuteReader())
{
while (dr.Read())
{
OracleLob lob = dr.GetOracleLob(0);
lob.Seek(0, System.IO.SeekOrigin.Begin);
lob.Write(System.Text.Encoding.Unicode.GetBytes(textToSave), 0,
textToSave.Length * 2);
}
}
tx.Commit();
conn.Close();
}
OracleDataReader that points to the NCLOB field. Make sure that you suffix your query with FOR UPDATE, or you won't be able to update your CLOB.OracleDataReader.
posted by Michael Russell at
1/18/2008 01:26:00 PM
![]()
Subscribe to
Posts [Atom]

1 Comments:
You're still developing new code using Oracle? Crap I thought I had you guys moving towards MS.
Post a Comment
Links to this post:
Create a Link
<< Home