Oracle processes Clob data warehouse receiving (String warehouse receiving)

Source: Internet
Author: User

Oracle processes Clob data warehouse receiving (String warehouse receiving)

You can search for a bunch of references from the Internet, either in unknown or not. You can load a pile of data into the database. Please refer to the final:

Insert into CP_V_INFO "+
"(ID," +
"PROJECT_ID," +
......
"V_INFO," +
......
"VERSION) values (?,?,?,?,?,?,?,?,?,?, "+
"?,?, EMPTY_CLOB (),?,?,?,?,?,?,?, "+
"?,?,?,?,?,?,?,?,?,?, "+
"?) ";
This.cdcDao.exe cuteSQL (SQL, v7Info. getId (),
V7Info. getProjectId (),......
);
// Insert the data first and use EMPTY_CLOB () to insert the data in this field.
// Then for update
String update_ SQL = "select V_INFO from CP_V_INFO where ID = '" + v7Info. getId () + "' for update ";
This.cdcDao.exe cuteClobSQL (update_ SQL, "V_INFO", v7Info. getvInfoStr ());

 

 

 

/**
*
* @ Method: executeClobSQL
* @ Description: update the Clob field.
* @ Param update_ SQL
* @ Param column field name data the field data
* @ Return
* @ Throws SQLException
* @ Throws Exception
* @ Author liuz
* @ Date 2016-3-28
*/
Public void executeClobSQL (String update_ SQL, String column, String data) throws SQLException, Exception {
If (MyJdbcTemplate) this. getJdbcTemplate (). isNEED_ENCODE ()){
Update_ SQL = new String (Response (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(.exe cuteQuery (update_ SQL );
If (rs. next ()){
/* Retrieve the CLOB object */
Oracle. SQL. CLOB clob = null;
Clob = (oracle. SQL. CLOB) rs. getClob (column );
/* Write data to the CLOB object */
BufferedWriter out = new BufferedWriter (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 ();
}
}
}
}

 

After numerous difficulties, my colleagues said, "Why should I change the underlying code ?". After a pleasant keyboard sound, the original method was changed. This field is inserted normally with a String. The result is: the database is imported normally. , And tears !!!!

 

String SQL = "insert into CP_V_INFO" +
"(ID," +
......
"V_INFO," +
......
"VERSION) values (?,?,?,?,?,?,?,?,?,?, "+
"?,?,?,?,?,?,?,?,?,?, "+
"?,?,?,?,?,?,?,?,?,?, "+
"?) ";
This.cdcDao.exe cuteSQL (SQL, v7Info. getId (),
......
V7Info. getvInfo (), // String type
......
V7Info. getVersion ());
/********* End **********/

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.