C#操作CLOB大对象的代码一例

发布时间:2020-11-19编辑:脚本学堂
C#如何操作CLOB大对象呢?本文给大家一个代码供参考,没有文字介绍,只有例子,有需要的朋友,参考下吧。

代码如下:

string filename = dirPath + "告警经验库信息.txt";
 
OracleConnection ocon = new System.Data.OracleClient.OracleConnection("data source=orcl;user id=ifms;pwd=ifms;");

ocon.Open();
OracleCommand ocmd = new OracleCommand("select count(*) from alarmcause t where t.vendor='ZY0801' and (experience is null or dbms_lob.compare(experience, empty_clob()) = 0) and t.probablecause='" + zhCause + "'", ocon);
int count = int.Parse(ocmd.ExecuteScalar().ToString());
ocon.Close();
//http://www.jb200.com
if (count > 0)
{
    ocon.Open();
    ocmd = new OracleCommand("update alarmcause set experience=:exper where vendor='ZY0801' and probablecause='" + zhCause + "'", ocon);
    OracleParameter op = new OracleParameter("exper", OracleType.Clob);
    op.Value = strhtml;
    ocmd.Parameters.Add(op);
    ocmd.ExecuteNonQuery();
    ocon.Close();
}