Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

inserting long text into Oracle CLOB

 
Tom Griffith
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello. If anybody has a minute, I am partially successful with inserting text into a CLOB. The problem is it's only a portion of the text.

this is the table desc..

A NOT NULL VARCHAR2(50)
B CLOB

however, when I try to insert a 450 character length string into B (the CLOB), it only seems to store the first 80 characters.

here is how i am populating the prepared statement...


statement.setString(1,"This is the text for A");


oracle.sql.CLOB clob=oracle.sql.CLOB.createTemporary(conn , false , oracle.sql.CLOB.DURATION_SESSION );
clob.open( oracle.sql.CLOB.MODE_READWRITE );
clob.setString(2,four_hundred_fifty_character_long_string);
statement.setClob(2, clob);


the clob inserts but like i said, it appears to truncate at 80 characters.

I plan on utilizing the prepared statement setAsciiStream stuff to generalize the code but i am suspecting the problem is lying with the CLOB itself or something at the database level. If anybody has any ideas, it would be greatly appreciated.

Thank you very much for reading.
[ July 18, 2008: Message edited by: Tom Griffith ]
 
Tom Griffith
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
after further review, i found that the default display length for CLOB, LONG and BLOB datatypes in SQL plus is 80 characters...so i entered SET LONG = 500 into sql plus on the command line and it seems to display everything. i had thought of doing a SQL select on the field, which i am still going to do, to make sure it has everything.

thank you for reading.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic