Oracle returns floats, why?

I’m not entirely clear what is going on, but I am using the oci driver
via Oracle Instant Client, and when I query out any fields from my
database any NUMBER fields come back with a .0 appended to them. Did I
do something wrong, or is there a way to turn this off?

Thanks,

Brian

Brian J. wrote:

I’m not entirely clear what is going on, but I am using the oci driver
via Oracle Instant Client, and when I query out any fields from my
database any NUMBER fields come back with a .0 appended to them. Did I
do something wrong, or is there a way to turn this off?

Fixed in trunk.

Brian J. wrote:

I’m not entirely clear what is going on, but I am using the
oci driver
via Oracle Instant Client, and when I query out any fields from my
database any NUMBER fields come back with a .0 appended to
them. Did
I do something wrong, or is there a way to turn this off?

Fixed in trunk.

How was it fixed, exactly? The Oracle NUMBER type can be integer or
floating point (it’s actually stored internally in decimal format). Are
you checking the scale, and returning an integer only if the scale is
zero?

  • Dan

This communication is the property of Qwest and may contain confidential
or
privileged information. Unauthorized use of this communication is
strictly
prohibited and may be unlawful. If you have received this communication
in error, please immediately notify the sender by reply e-mail and
destroy
all copies of the communication and any attachments.

When you say ‘trunk’, is that the OCI8 driver? Ruby? Or Rails?

I checked EdgeRails into my project, but the same problem occurs.
Guessing that wasn’t it?

Brian

Berger, Daniel wrote:

How was it fixed, exactly? The Oracle NUMBER type can be integer or
floating point (it’s actually stored internally in decimal format). Are
you checking the scale, and returning an integer only if the scale is
zero?

Yep. So if the column is explicitly defined in the db as being an
integer, you get an integer.

Brian J. wrote:

When you say ‘trunk’, is that the OCI8 driver? Ruby? Or Rails?

I checked EdgeRails into my project, but the same problem occurs.
Guessing that wasn’t it?

Brian

Well, I dug through the source files and saw the changes in
active_record/connection_adapters/oracle_adapter.rb, however they don’t
seem to be fixing the issue. I checked my database NUMBER columns, and
they are set correctly as well.

Do I still have something misconfigured?

Brian

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs