Gossamer Forum
Home : General : Databases and SQL :

LONG/CLOB datatype inserts truncated

Quote Reply
LONG/CLOB datatype inserts truncated
Hi all

I've been learning sql/oracle from a book, so bear with me if this sounds easy. I defined an attribute as CLOB and I'm trying to store raw text. I tested it with a stream of sssss's, but Oracle truncates my inserts to 2,499 characters. Same thing happens to LONG. Why is this happening? I thought I can store up to 4 GB? If I can't fix this, is there another datatype that allows me to store raw text AND permit more than 2,499 characters?

Cheers
Quote Reply
Re: [Stupe] LONG/CLOB datatype inserts truncated In reply to
Hi,

What are you using to do the INSERT? In Perl, you need to bind the long value, and can't just put it in the SQL string. For instance:

my $insert = $dbh->prepare("INSERT INTO tablename (long_column) VALUES (?)");
$insert->bind_param(1, $long_value, { ora_type => ORA_CLOB, ora_field => 'long_column' });
$insert->execute();

The long data you are inserting is in $long_value, and you bind it to the ? using the bind_param() method.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Stupe] LONG/CLOB datatype inserts truncated In reply to
CLOB data type is primarily useful for storing foreign language characters.

If all you want to store is long strings of regular text characters, then I'd suggest using VARCHAR2 data type and set the size to 10000.

Good luck.
========================================
Buh Bye!

Cheers,
Me
Quote Reply
Re: [Stupe] LONG/CLOB datatype inserts truncated In reply to
Just for reference:

http://www.cisco.com/.../schema/30scappa.htm
Quote Reply
Re: [Stealth] LONG/CLOB datatype inserts truncated In reply to
Thanks alot for the prompt reply guys... posted in other forums, and got no help...

Anyway, about the insert, I'm typing it out in Notepad, and then pasting it in Oracle's SQL Plus.

As for the idea of using VARCHAR2, I am quite content setting it to 10,000, but I've been asked to try my best to fit as much as I can. Buggers...

Thanks again guys
Quote Reply
Re: [Stupe] LONG/CLOB datatype inserts truncated In reply to
guys, don't bother about a solution. Someone gave me quite an interesting url...

"http://philip.greenspun.com/sql/limits.html"