ruby-plsql icon indicating copy to clipboard operation
ruby-plsql copied to clipboard

Session variables with subtypes crash

Open apeiros opened this issue 3 years ago • 0 comments

Tested in version 0.7.1

If a session variable uses a subtype, querying its value or trying to set its value crashes.

To reproduce, create the following package in a schema:

CREATE OR REPLACE PACKAGE demo_pkg IS
   SUBTYPE demo_type IS NUMBER(38,0) NOT NULL;
   demo_var1 NUMBER(38,0) := 21;
   demo_var2 demo_pkg.demo_type := 34;
END;

And run this ruby code in e.g. a rails console

plsql.demo_pkg.demo_var1 # => 21 (as expected)
plsql.demo_pkg.demo_var2 # !> ArgumentError (Package variable data type DEMO_PKG.DEMO_TYPE is not object type defined in schema)

For people experiencing the same problem: I currently work around the problem by wrapping the variable access in functions which typecasts to base types.

apeiros avatar Sep 30 '22 09:09 apeiros