In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article will explain in detail what to do when there is a problem with the insertion of oracle into the clob field. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.
1. Use the insert statement to insert the clob field. If the insert content exceeds 4000, the string will be prompted to be too long. The way to handle this is to declare that the inserted field is of type clob, as follows:
InsertSql = "DECLARE email_text clob: ='% s'; begin insert into emails values ('% ringing recording% s tracking of key stocks (% s)','0 stocks tracking'); end;"% (
Email_text,id, contactEamilAddress, dateInput)
Updating the above method will report the following error:
Cx_Oracle.DatabaseError: ORA-06550: line 1, column 28:
PLS-00172: string literal too long
Change it to the following method, and put the parameters in a single array:
InsertSql = "insert into business_EMAILS values (: 1, 1, 1, 2, 3, 3, 4, 1, 5)"
Params = [id, contactEamilAddress, email_text,' key stock tracking ({0}) '.format (dateInput), contactUserId]
Cur.execute (insertSql,params)
Conn.commit ()
two。 With the result set of python, when the clob field is read, it is converted to str type processing, as follows:
Cur_bbc.execute ("select t.times, 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
This is the end of the article on "what to do if there is a problem with oracle inserting clob fields". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.