Oracle handles CLOB type data warehousing (string warehousing)

Source: Internet
Author: User

Find a bunch of references online, either vague or not. I tinker with a bunch can be normal storage. Take a look at the end:

Insert INTO Cp_v_info "+" (ID, "+" project_id, "+..."V_info," +..."VERSION" VALUES (?,?,?,?,?,?,?,?,?,?, "+"?,?, Empty_clob (),?,?,?,?,?,?,?, "+"?,?,?,? ,?,?,?,?,?,?," +                    "?)";  This. Cdcdao.executesql (SQL, V7info.getid (), V7info.getprojectid (),......);//Insert the data first, and insert it in the field with Empty_clob (). //Then for updateString update_sql = "Select V_info from Cp_v_info where id= '" +v7info.getid () + "A For Update";  This. Cdcdao.executeclobsql (Update_sql, "V_info", V7info.getvinfostr ());

/*** * @Method: Executeclobsql * @Description: Update clob field *@paramUpdate_sql *@paramcolumn Field name data for this field *@return     * @throwsSQLException *@throwsException *@authorLiuz * @date 2016-3-28*/     Public voidExecuteclobsql (String update_sql,string column,string data)throwsSQLException, Exception {if((myjdbctemplate) This. Getjdbctemplate ()). Isneed_encode ()) {Update_sql=NewString (Update_sql.getbytes ((myjdbctemplate) This. Getjdbctemplate ()). Getapp_encode ()), ((myjdbctemplate) This. Getjdbctemplate ()). Getdb_encode ()); } PreparedStatement P=NULL; ResultSet RS=NULL; Try{Connection conn= This. getconnection (); Conn.setautocommit (false); P=Pasersql (conn, update_sql); RS=conn.createstatement (). ExecuteQuery (Update_sql); if(Rs.next ()) {/*remove this Clob object*/Oracle.sql.CLOB CLOB=NULL; CLOB=(Oracle.sql.CLOB) rs.getclob (column); /*writing data to a Clob object*/BufferedWriter out=NewBufferedWriter (Clob. Getcharacteroutputstream ());                    Out.write (data);                    Out.flush ();            Out.close ();            } rs.close ();            Conn.commit (); Conn.setautocommit (true); } finally {            if(rs! =NULL) {                Try{rs.close (); } Catch(SQLException e) {e.printstacktrace (); }            }            if(P! =NULL) {                Try{p.close (); } Catch(SQLException e) {e.printstacktrace (); }            }        }    }

Hardships Daoteng Warehousing, colleagues said a sentence "Why to change the underlying code?" ”。 After popping a melodious keyboard sound, change back to the original way. The field is inserted normally with String. The result is: normal storage. 、、、、、、、、、、 tears ben!!!!

String sql = "INSERT INTO Cp_v_info" +                    "(ID," +                    ...                    ") V_info, "+                    ...                    " VERSION) VALUES (?,?,?,?,?,?,?,?,?,?, "+                    "?,?,?,?,?,?,?,?,?,?, "+                    "?,?,?,?,?,?,?,?,?,?, "+                    "?) " ;          This . Cdcdao.executesql (SQL, V7info.getid (),                ...                V7info.getvinfo (),//String type ...                 V7info.getversion ()); /* ******** End ********* */

Oracle handles CLOB type data warehousing (string warehousing)

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.