-
Notifications
You must be signed in to change notification settings - Fork 61
Description
Versions:
ruby: 2.6.6
ruby-oci8 (2.2.8)
ruby-plsql (0.7.1)
I am trying to run a store procedure but I am getting the following message (OCI8::Cursor was already closed.)
This is my store procedure:
CREATE OR REPLACE PROCEDURE store_example_proc(
cursorParam OUT SYS_REFCURSOR)
IS
BEGIN
OPEN cursorParam FOR
SELECT * FROM SA_TRANS_STATUS;
END;And this is the way calling from ruby code
plsql.store_example_proc[:cursorparam].fetchthe ouput is:
plsql.store_example_proc[:cursorparam]
=> #<PLSQL::OCIConnection::Cursor:0x0000562fdf4edaa8 @connection=#<PLSQL::OCIConnection:0x0000562fe36ce940 @raw_driver=:oci, @raw_connection=#OCI8:NS_SWITCH_PRD, @activerecord_class=nil, @database_version=[11, 2, 0, 4]>, @raw_cursor=#<OCI8::Cursor:0x0000562fde7341a0 @bind_handles={}, @define_handles=[#OCI8::BindType::String:0x0000562fdf4ee098, #OCI8::BindType::String:0x0000562fdf4edf08, #OCI8::BindType::Time:0x0000562fdf4edeb8, #OCI8::BindType::Integer:0x0000562fdf4ede40, #OCI8::BindType::Time:0x0000562fdf4eddf0, #OCI8::BindType::Integer:0x0000562fdf4edd00], @column_metadata=nil, @NAMEs=nil, @con=#OCI8:NS_SWITCH_PRD, @max_array_size=nil, @fetch_array_size=nil, @rowbuf_size=0, @rowbuf_index=0, @prefetch_rows=100>>
2.6.6 :022 > plsql.store_example_proc[:cursorparam] do |cursor| cursor.fetch end
=> #<PLSQL::OCIConnection::Cursor:0x0000562fdf8fd490 @connection=#<PLSQL::OCIConnection:0x0000562fe36ce940 @raw_driver=:oci, @raw_connection=#OCI8:NS_SWITCH_PRD, @activerecord_class=nil, @database_version=[11, 2, 0, 4]>, @raw_cursor=#<OCI8::Cursor:0x0000562fdf91b418 @bind_handles={}, @define_handles=[#OCI8::BindType::String:0x0000562fdf8fdc60, #OCI8::BindType::String:0x0000562fdf8fd968, #OCI8::BindType::Time:0x0000562fdf8fd738, #OCI8::BindType::Integer:0x0000562fdf8fd5a8, #OCI8::BindType::Time:0x0000562fdf8fd558, #OCI8::BindType::Integer:0x0000562fdf8fd4b8], @column_metadata=nil, @NAMEs=nil, @con=#OCI8:NS_SWITCH_PRD, @max_array_size=nil, @fetch_array_size=nil, @rowbuf_size=0, @rowbuf_index=0, @prefetch_rows=100>>
2.6.6 :023 > plsql.store_example_proc[:cursorparam].fetch
Traceback (most recent call last):
1: from (irb):23
OCIException (OCI8::Cursor was already closed.)
I'm doing something wrong?