# Oracle\_adapter weirdness

**URL:** <https://www.ruby-forum.com/t/oracle-adapter-weirdness/107428>\
**Category:** Rails\
**Created:** [June 21, 2007, 6:25pm UTC](https://www.ruby-forum.com/t/oracle-adapter-weirdness/107428 "2007-06-21T18:25:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bill\_Hansley](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/41988e/32.png) [@Bill\_Hansley](https://www.ruby-forum.com/u/Bill_Hansley)\
**Post date:** [June 21, 2007, 6:25pm UTC](https://www.ruby-forum.com/t/oracle-adapter-weirdness/107428/1 "2007-06-21T18:25:58Z")

</div>

Hi all,

I’m trying to put together a quickie front-end for a maintenance task  
that has to be done on a legacy Oracle database. In particular,  
putting a date criteria in my conditions clause causes rails not to  
return any rows, ever, even when the same where clause works fine  
elsewhere.

Ever seen anything like this?

In rails (either script/console or from my controller call), no  
records get returned.No error messages, it just doesn’t return  
anything.

script/console  
Loading development environment.  
– Followup.find(:all, :conditions =\> “group\_id = 3 AND  
trunc(time\_stp) = ‘07JAN2007’”)  
=\> []

Development log looks fine. In fact, this sql works great in sqlplus.  
Rails just isn’t getting anything back.

Followup Load (0.124121) SELECT \* FROM followup WHERE (group\_id =  
3 AND trunc(time\_stp) = ‘07JAN2007’)

In IRB (and sql plus) things work like I’d expect:

irb(main):005:0\> OCI8.new(“myuser”, “mypwd”, “myinstance”).exec("  
SELECT \* FROM followup where group\_id = 3 AND trunc(time\_stp) =  
‘07JAN2007’") do |r| puts r.join(","); end  
503252,503251,3,5449,2007/01/07 02:04:06,  
503255,503254,3,8026,2007/01/07 02:06:06,  
503355,503354,3,214938,2007/01/07 19:05:16,  
503359,503357,3,503358,2007/01/07 19:06:56,  
503313,503311,3,503312,2007/01/07 15:07:50,  
503315,503161,3,503314,2007/01/07 15:08:35,  
=\> 6

The problem, whatever it is, is related to the date part of the  
comparison. If I take the date bits out, then rails makes the call  
just fine.

Any and all help appreciated!
