From: Peter Hickman on
On 16 April 2010 12:57, Mitja Čebokli <mitja.cebokli(a)svashta.com> wrote:

> On the other hand, not using :col_sep is giving me an error:
> can't convert String into Integer (TypeError)
>
> Maybe the formatting of the line is wrong?
>
>
Well if :col_sep works for you then use it. Perhaps this is a gem version
issue. It didn't like it for me.

One more question on this matter.
> How do I extract/use the table columns from the select file or if used
> as "select *" to extract all the column names, and than use them as a
> CSV header.
>
>
Sorry I have no knowledge of the Oracle db driver so I can't help you with
that.

I have a problem, as it seems, with columns where data are numbers.
> For example, row with ID number is returning me something like 0.2001E4
>

How is the data being returned from the database? If Oracle is returning the
data in this format 0.2001E4 (as a string) then ruby will just copy it as
is. I suspect that Oracle is returning the float as a string because ruby
would display 0.2001E4 as 2001.0 if it was actually given as a number.

You might need to convert the data to get the values displayed in a sensible
way.

a = "0.2001E4" => "0.2001E4"
a.to_f => 2001.0
a.to_f.to_s => "2001.0"

From: KUBO Takehiro on
On Fri, Apr 16, 2010 at 9:02 PM, Mitja Čebokli
<mitja.cebokli(a)svashta.com> wrote:
> And one more thing :)
>
> I have a problem, as it seems, with columns where data are numbers.
> For example, row with ID number is returning me something like 0.2001E4

How did you define the ID number.
If it is defined as NUMBER, the column is not an integer and it may not fit to
Float. Thus ruby-oci8 fetch it as BigDecimal by default.
See: http://rubyforge.org/forum/forum.php?thread_id=47561&forum_id=1078

Could you redefine the ID as NUMBER(38) or so?