# Populating long data column with Ruby OCI8

**URL:** <https://www.ruby-forum.com/t/populating-long-data-column-with-ruby-oci8/52631>\
**Category:** Ruby\
**Created:** [January 17, 2006, 7:08am UTC](https://www.ruby-forum.com/t/populating-long-data-column-with-ruby-oci8/52631 "2006-01-17T07:08:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gennady\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/c57346/32.png) [@Gennady\_B](https://www.ruby-forum.com/u/Gennady_B)\
**Post date:** [January 17, 2006, 7:08am UTC](https://www.ruby-forum.com/t/populating-long-data-column-with-ruby-oci8/52631/1 "2006-01-17T07:08:27Z")

</div>

Hi, friends

I am back to the list after a while. And I start the reunion with a  
question ;-).

Is there any way to insert a big chunk of data (say, 100K) into a column  
of type long with Ruby OCI8 or by any other Ruby means? I saw that to do  
it in C you must be prepared to handle OCI error code inviting you to  
insert another piece. But how to do it in Ruby, especially with OCI8? If  
I do

require ‘oci8’

db = OCI8.new ‘system’, ‘manager’  
db.exec(“create table sample (id number, data long)”)

data = ‘A’ \* 1024 \* 100

c = db.parse(‘insert into sample values (2, :data)’)  
c.bind\_param(’:data’, data)

c.exec  
db.commit

What I end up with in column ‘data’ is host dependent (or db block size  
dependent?). I observed 14464 bytes on 2K database on Solaris, and 34652  
bytes on 8K database on Linux.

Thank you,  
Gennady B…
