• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

inserting long text into Oracle CLOB

 
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
It's hard to fight evil. The little things, like a nice sandwich, really helps. Right tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic