Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCI8::Cursor was already closed. #189

Open
adrian-netapay opened this issue Jul 28, 2020 · 0 comments
Open

OCI8::Cursor was already closed. #189

adrian-netapay opened this issue Jul 28, 2020 · 0 comments

Comments

@adrian-netapay
Copy link

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].fetch

the 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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant