2
下面是我的表CLOB在Oracle不允許插入數據超過4000個字符
create table MY_LOG(SQNO NUMBER, CLOB_FLD CLOB);
下面是我的INSERT語句從Java端執行
stmt.execute(new StringBuilder(
"INSERT INTO MY_LOG VALUES ('").append(logMessage.getNo()).append("','").append(logMessage.getStackTrace()).append("')"));
堆棧跟蹤過大,即大於4000個字符。所以它扔
SQL Error: ORA-01704: string literal too long
01704. 00000 - "string literal too long"
*Cause: The string literal is longer than 4000 characters.
*Action: Use a string literal of at most 4000 characters.
Longer values may only be entered using bind variables.
是否有任何功能或程序內置或者是有什麼我可以做,以使這項工作正常?
在此先感謝..
嘗試創建connection.createClob(CLOB )。拋出異常。引起:java.lang.AbstractMethodError:oracle.jdbc.driver.OracleConnection.createClob()Ljava/sql/Clob; –
您需要ojdbc6.jar,createClob自1.6 –
請參閱教程:http://tutorials.jenkov.com/jdbc/preparedstatement.html – loopasam