Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

tables as parameters malfunction when using ruby-oci8 v2.0.6 #19

Closed
damada opened this Issue · 3 comments

3 participants

@damada

When passing a table to a procedure, the table is received as empty when using ruby-oci8 v2.0.6.
Below is example PL/SQL and Ruby.

--BEGIN PL/SQL
--CREATE TYPES

create or replace
TYPE example_o AS OBJECT
(aa INTEGER, bb INTEGER);

create or replace
TYPE example_t IS TABLE OF example_o;

--CREATE PACKAGES
create or replace
PACKAGE EXAMPLE_PKG
IS

PROCEDURE oci_fail_example(example_table_in example_t); 

END;

create or replace
PACKAGE BODY EXAMPLE_PKG
IS

PROCEDURE oci_fail_example(
    example_table_in example_t )
IS

BEGIN
dbms_output.put_line(example_table_in(1).aa);

  -- ORA-06531: Reference to uninitialized collection results from the below
  dbms_output.put_line(example_table_in(1).bb);
  dbms_output.put_line('aaa');
END oci_fail_example;

END;

--END PL/SQL

#BEGIN TEST SPEC EXAMPLE
require File.expand_path('spec/spec_helper')
plsql.dbms_output_stream = STDOUT

describe "The function oci_fail_example()" do

testdate = Time.local(2011,03,01,00)

test_table = [{ :aa => 1,
:bb => -1},
{:aa => 2,
:bb => -1},
{:aa => 3,
:bb => -1}
]

it "1. " do

plsql.example_pkg.oci_fail_example(test_table)

end

end

#END TEST SPEC EXAMPLE

The reason for failure seems to be that ruby-oci8 2.0.6 does not work the same as 2.0.4.
The failure is experienced on 2.0.6:

F

Failures:

1) The function oci_fail_example() 1.
Failure/Error: plsql.example_pkg.oci_fail_example(test_table)
OCIError:
ORA-06531: Reference to uninitialized collection
ORA-06512: at "DTE.EXAMPLE_PKG", line 8
ORA-06512: at line 5
# stmt.c:312:in oci8lib_191.so
# ./spec/test_spec.rb:23:in `block (2 levels) in '

Finished in 0.07007 seconds
1 example, 1 failure

Failed examples:

rspec ./spec/test_spec.rb:20 # The function oci_fail_example() 1.
false
Failing tests!

If I rollback to 2.0.4, then it works as expected.

A possible short term fix is to depend on =2.0.4, not >=2.0.4

@rsim
Owner

Could you please test this with latest ruby-oci8 version 2.1.0? (I am updating ruby-plsql to use this version now)

@yahonda
Collaborator

Please reopen if it still reproduces with ruby-oci8 2.1.0 or later version.

@yahonda yahonda closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.