# Oracle string literal too long error

**URL:** <https://www.ruby-forum.com/t/oracle-string-literal-too-long-error/76323>\
**Category:** Rails\
**Created:** [November 17, 2006, 4:50pm UTC](https://www.ruby-forum.com/t/oracle-string-literal-too-long-error/76323 "2006-11-17T16:50:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/97f17d/32.png) [@tomx](https://www.ruby-forum.com/u/tomx)\
**Post date:** [November 17, 2006, 4:50pm UTC](https://www.ruby-forum.com/t/oracle-string-literal-too-long-error/76323/1 "2006-11-17T16:50:31Z")

</div>

Hello Forum Folks

I’ve written a lovely app for writing new stories. Unfortunately our  
company has a Oracle Database and insists that everyone use it.

The main body of each of my new stories is stored in a CLOB which can  
store more than enough data for the stories. However there is a 4000  
char limit on the size of String literals in SQL statements in Oracle  
that I don’t know how to get round.

So I can use rails just fine as long as the length of the story is less  
than 4000, and even then it’s not the storage that’s the problem it’s  
the inserting that fails.

Because Rails does all of it’s database interaction via SQL and I can’t  
insert big stories via SQL am I stuffed? or is there a way around it.  
I’m quite happy to go hacking around the Rails Oracle Driver if that’s  
what required but I thought I’d ask the question here first because I’m  
sure I’m not the first to get caught out by this problem. Plus if I do  
need to hack the Oracle rails driver then if someone could give me a  
hint as to where to start that would be great.

Any help is really appreciated.  
Thanks  
Tom

---

<div class="post-metadata">

**Author:** ![tomx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/97f17d/32.png) [@tomx](https://www.ruby-forum.com/u/tomx)\
**Post date:** [November 17, 2006, 8:59pm UTC](https://www.ruby-forum.com/t/oracle-string-literal-too-long-error/76323/2 "2006-11-17T20:59:21Z")

</div>

On 11/17/06, Tom S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> The main body of each of my new stories is stored in a CLOB which can  
> store more than enough data for the stories. However there is a 4000  
> char limit on the size of String literals in SQL statements in Oracle  
> that I don’t know how to get round.

I almost told you to forget CLOBs because it’s a pain to work with them,  
but  
found out that they are useable (you can even search/update them!) with  
recent (\>= 9) Oracle versions.

However, searching google for CLOB Oracle Rails found a rails patch:  
[http://dev.rubyonrails.org/ticket/4748](http://dev.rubyonrails.org/ticket/4748)
