java - CLOB in oracle not allowing to insert data more than 4000 chars -


below table

create table my_log(sqno number, clob_fld clob); 

below insert statement executed java side

stmt.execute(new stringbuilder(                 "insert my_log values ('").append(logmessage.getno()).append("','").append(logmessage.getstacktrace()).append("')")); 

the stacktrace large i.e more 4000 characters. throwing

sql error: ora-01704: string literal long 01704. 00000 -  "string literal long" *cause:    string literal longer 4000 characters. *action:   use string literal of @ 4000 characters.            longer values may entered using bind variables. 

is there function or procedure inbuilt or there can make work ??

thanks in advance..

use preparedstatement, create clob connection.createclob, put text clob clob.setstring, set preparedstatement parameter preparedstatement.setclob


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -