Oracle_adapter weirdness


#1

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!