1.用insert语句,插入clob字段,如果插入内容超过4000,会提示字符串过长,处理的方法是,先声明插入的字段为clob类型,如下:
insertSql = "DECLARE email_text clob := ‘%s‘; begin insert into emails values (‘%r‘,‘%s‘,email_text,‘重点股票跟踪(%s)‘,‘0‘,‘‘); end;" % (
email_text,id, contactEamilAddress, dateInput)
2.用python的结果集,读取到clob字段的时候,转化为str类型处理,如下:
cur_bbc.execute("select t.*, t.rowid from emails t where t.email_status = ‘0‘")
res = cur_bbc.fetchall()
for record in res:
id = record[0]
to_email = record[1]
to_email_list = to_email.split(",")
email_text = record[2].read() --clob类型
原文地址:http://blog.51cto.com/12096733/2060350
时间: 2024-10-09 07:11:55