Oracle Insert Clob field problem and Python read Clob field

Source: Internet
Author: User
1. Insert the Clob field with an INSERT statement, and if the insert is more than 4000, the string is too long to be handled by first declaring the inserted fields as CLOB type, as follows:
Insertsql = "DECLARE email_text clob: = '%s '; Begin INSERT into emails values ('%r ', '%s ', Email_text, ' focus stock tracking (%s) ', ' 0 ', '); End; "% (
Email_text,id, contacteamiladdress, Dateinput)

2. Using the python result set, when reading to the Clob field, convert to STR type processing, as follows:
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 type

Oracle Insert Clob field problem and Python read Clob field

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.