This discussion is archived
0 Replies Latest reply: Mar 21, 2008 1:18 PM by 288739 RSS

ruby-plsql - simple Ruby API for PL/SQL procedures

288739 Newbie
Currently Being Moderated
I have created ruby-plsql gem which provides much more simple access to PL/SQL procedures compared to standard ruby-oci8 API.

So instead of
conn = OCI8.new("hr","hr","xe")
cursor = conn.parse <<-EOS
BEGIN
  :return := test_uppercase(:p_string);
END;
EOS
cursor.bind_param(':p_string',"xxx",String)
cursor.bind_param(':return',nil,String,4000)
cursor.exec
puts cursor[':return']
cursor.close
you can do it much more simply:
plsql.connection = OCI8.new("hr","hr","xe")
puts plsql.test_uppercase('xxx')
Here are some more samples:
plsql.test_uppercase(:p_string => 'xxx')
plsql.hr.test_uppercase('xxx')
plsql.hr.test_package.test_uppercase('xxx')
plsql.test_copy("abc", nil, nil) # returns output arguments { :p_to => "abc", :p_to_double => "abcabc" }
See more details in this blog post.