I am trying to execute a stored procedure with ruby-oci8 gem. And I can execute normal queries but not my procedure.
# irb -r oci8
Warning: NLS_LANG is not set. fallback to US7ASCII.
irb(main):001:0> conn = OCI8.new('AAA/AAA@//10.112.68.14:1521/dptedp0')
irb(main):002:0> conn.exec("SELECT * FROM mytable"){|r| puts r.join(", ")}
1, user1, data1
2, user2, data2
irb(main):003:0> conn.exec("ALTER TRIGGER trigger_mytable_id ENABLE")
=> 0
irb(main):004:0> conn.exec("ALTER TRIGGER trigger_mytable_id DISABLE")
=> 0
until here all works fine, but when I try to execute a procedure, it didn't work.
irb(main):005:0> conn.exec("EXECUTE reset_seq( 'mytable_id_seq', 'mytable', 'id' )")
OCIError: ORA-00900: invalid SQL statement
from stmt.c:253:in oci8lib_191.so
from /opt/ruby/gems/ruby-oci8-2.1.2/lib/oci8/oci8.rb:474:in `exec'
from /opt/ruby/gems/ruby-oci8-2.1.2/lib/oci8/oci8.rb:282:in `exec_internal'
from /opt/ruby/gems/ruby-oci8-2.1.2/lib/oci8/oci8.rb:275:in `exec'
from (irb):9
from /usr/bin/irb:12:in `<main>'
My procedure works well in sqldeveloper.
execute reset_seq( 'lrf_id_seq', 'lrf', 'id' )
anonymous block completed
I doesn't return any value. Is it possible to execute a procedure like this with oci8 gem?
I am using: ruby 1.9.3p429 ruby-oci8 (2.1.2)