Tuesday, October 27, 2009

[Rails] Re: Call an Oracle function

If you just want to call a function you could do something like

results = ActiveRecord::Base.connection.select_all "select my_function
('some argument') value from dual"
puts results.first['value']

For example
>> ActiveRecord::Base.connection.select_all "select 7+5 value from dual"
=> [{"value"=>12}]


If you have a more complicated plsql stored procedure that maybe sets
more than one result parameter you can use the plsql gem
http://github.com/rsim/ruby-plsql. This gem lets you call arbitrary
plsql procedures with any input or output parameters.

Hope this helps
--Alex


On Oct 27, 8:10 am, Rafael Roque <rails-mailing-l...@andreas-s.net>
wrote:
> Hi all,
> I need to call a Oracle function from Rais.Does anyone have some
> experience with it?
>
> Thanks,
> Rafael
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate