activerecord-jdbc-plsql
activerecord-jdbc-plsql provide a Ruby wrapper to use PL/SQL with Active Record and JDBD.
Installation
Add this line to your application's Gemfile:
gem 'activerecord-jdbc-plsql'
And then execute:
$ bundle
Or install it yourself as:
$ gem install activerecord-jdbc-plsql
Usage
activerecord-jdbc-plsql provide a new method to call PL/SQL programs. Use call_procedure from your models. Example:
Standard
result = call_procedure('my_procedure', 'value1', 'value2', :integer)
This call will return this ruby hash:
{
3 => 'the expected value'
}
The key will be the parameter index starting at 1 ( accordance with JDBC API ).
With named parameters
result = call_procedure('my_procedure', an_input_parameter: 'value1', an_other_input_parameter: 'value2', an_output_parameter: :integer)
This call will return this ruby hash:
{
an_output_parameter: 'the expected value'
}
Supported types are:
:binary
:boolean
:date
:datetime
:decimal
:float
:integer
:string
:text
:time
:timestamp
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request