DBI Oracle error

I'm not sure what to tell you Graham. One thing I would try is
explicitly converting the floats to strings using sprintf (or
whatever), so you can set the precision, then calling to_number() on
those values. See if that helps.

Regards,

Dan

···

-----Original Message-----
From: graham [mailto:fghfghfh@homr.vom]
Sent: Tuesday, June 07, 2005 2:15 PM
To: ruby-talk ML
Subject: Re: DBI Oracle error

Berger, Daniel wrote:
> My (possibly wrong) initial guess would be a precision
error of some
> sort in conjunction with Ruby's .to_f. Double check the the column
> types (presumably a NUMBER) and see what the precision is
set to. The
> column precision *is* set, right?
Nope - not explicitly. The column is just defined as NUMBER.
If this was
the problem - how come
a) almost identical data lines either side work correctly
b) running the data thorough again will correctly insert the
offending
row into the database (other rows fail to insert due to filing a
uniqueness constraint on the datetime column)

I'm perplexed. I don't have a real debugger for Ruby.. just
the built in
one (which is a bit painful to use).
Graham

My first attempt at debugging adopts your idea, so for the
parameterised insert of:
sth = dbh.prepare("INSERT INTO EFFLUENT_LOG (datetime, suspect, flow,
temp, ph) VALUES(to_date(?, 'DD/MM/YY HH24:MI:SS'), ?, ?, ?, ?)");

I now run on a row by row basis:-
sth.execute((date + " " + time), val, sprintf("%3.1f",flow.to_f).to_f,
sprintf("%4.2f", temp.to_f).to_f, sprintf("%5.2f",ph.to_f).to_f)
whic smacks of paranoia in my book. However still get exactly the same
failures. (BTW The suspect field is a single character 'Y' or 'N' )

I'm beginning to think DBI for Oracle is extremely buggy.

Any suggestions for an alternative interface to Oracle, or ideas what
the problem might be?
Regards
Graham