Oracle Clob字段保存时提示字符串过长

 因为Oracle的SQL语句不能过长,大约4K限制,所以如果保存时Clob字段的内容过长的话会导致保存出错,提示"ORA-01704:文字字符串过长 "

解决方案是带参数的update语句

  strSql = "update web_goods set producthtml= :output where productid='"+strProductid+"'";
   OracleParameter[] ps=new OracleParameter[1];

   ps[0] = new OracleParameter();
   ps[0].ParameterName = ":output";
  ps[0].OracleType = OracleType.Clob;
  ps[0].Value = output;
             
 OraHelper.ExecuteNonQuery(OraHelper.CONN_STRING,CommandType.Text,strSql,ps);

原文地址:https://www.cnblogs.com/jameshappy/p/2682942.html