# Datatype problem when using ActiveRecord with Oracle

**URL:** <https://www.ruby-forum.com/t/datatype-problem-when-using-activerecord-with-oracle/142202>\
**Category:** Rails\
**Created:** [July 4, 2008, 3:15pm UTC](https://www.ruby-forum.com/t/datatype-problem-when-using-activerecord-with-oracle/142202 "2008-07-04T15:15:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Niranjan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/e99b99/32.png) [@Niranjan](https://www.ruby-forum.com/u/Niranjan)\
**Post date:** [July 4, 2008, 3:15pm UTC](https://www.ruby-forum.com/t/datatype-problem-when-using-activerecord-with-oracle/142202/1 "2008-07-04T15:15:35Z")

</div>

Hey,  
I have connected to the oracle db using ActiveRecord and am  
trying to retrieve tuples. I have one attribute that has datatype  
‘number(1)’. I found that ActiveRecord maps this attribute to boolean.  
So it gets a class of either FalseClass or TrueClass. I tried to find  
the source of the problem and I found oracle\_adapter.rb (http://  
[www.koders.com/ruby/fidAF6400E299159A198A4064173CF305C895FCA945.aspx?s=“Michael+Schoen”#L5](http://www.koders.com/ruby/fidAF6400E299159A198A4064173CF305C895FCA945.aspx?s=%22Michael+Schoen%22#L5))  
has a method ‘simplified\_field’ that has a line  
“return :boolean if OracleAdapter.emulate\_booleans && field\_type ==  
‘NUMBER(1)’”.  
I tried overriding this method on my environment.rb and commented out  
this line. This problem is solved but I have another field of type  
‘Interval’ which has to get mapped to String, but instead gets mapped  
to Fixnum when i do this override. Anyone got a clue what’s happening.  
Please help.

---

<div class="post-metadata">

**Author:** ![Niranjan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/e99b99/32.png) [@Niranjan](https://www.ruby-forum.com/u/Niranjan)\
**Post date:** [July 4, 2008, 3:23pm UTC](https://www.ruby-forum.com/t/datatype-problem-when-using-activerecord-with-oracle/142202/2 "2008-07-04T15:23:48Z")

</div>

It would even be useful if anyone told me how to update the database  
without  
using ActiveRecord::update() and just by pure sql command.
