Ruby OCI8 Library Unsupported Datatypes

April 17, 2007

If you find yourself in the nasty position of having to use Oracle with Ruby, watch out for a problem related to unsupported datatypes. Specifically these types:

  • SQLT_TIMESTAMP
  • BINARY_DOUBLE
  • BINARY_FLOAT

However, I found a little quick fix that seems to work. Add this to your code:


require 'oci8'

# handle the timestamp mapping
OCI8::BindType::Mapping[OCI8::SQLT_TIMESTAMP] =
OCI8::BindType::OraDate

# handle the binary_float
OCI8::BindType::Mapping[100] = OCI8::BindType::Float

# handle the binary_double
OCI8::BindType::Mapping[101] = OCI8::BindType::Float

The good news is it looks like the fix will be in the next release of OCI8.