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

ruby-plsql 0.8.0 / Oracle 19c: "No PL/SQL procedure or variable 'VERSION' found" when accessing plsql.dbms_db_version.version #207

Open
joschug opened this issue Oct 12, 2021 · 0 comments

Comments

@joschug
Copy link

joschug commented Oct 12, 2021

When we try to access the constant version in package sys.dbms_db_version, ruby-plsql bails out with

No PL/SQL procedure or variable 'VERSION' found
package.rb:83:in `method_missing'

The cause seems to be a change in the source code of sys.dbms_db_version in combination with the way plsql-ruby tries to identify variables and constants.
variable.rb selects all rows from all_source that match the variable name and then verifies the variable with a regex. The regex assumes that the variable declaration ends with a semicolon on the same line.
Unfortunately, this fails if the assignment to the variable is wrapped to the next line. This is exactly what changed in sys.dbms_db_version between 12 and 19:

SELECT * FROM all_source WHERE owner = 'SYS' AND name = 'DBMS_DB_VERSION' AND type = 'PACKAGE';

-- Oracle 12:
package dbms_db_version is
  version constant pls_integer := 12; -- RDBMS version number
  release constant pls_integer := 2;  -- RDBMS release number

-- Oracle 19:
package dbms_db_version is
  version constant pls_integer :=
          19; -- RDBMS version number
  release constant pls_integer := 0;  -- RDBMS release number

An easy fix would be to make the semicolon at the end of the line optional. I can create a PR if that's acceptable.

@joschug joschug changed the title Oracle 19c: "No PL/SQL procedure or variable 'VERSION' found" when accessing plsql.dbms_db_version.version ruby-plsql 0.8.0 / Oracle 19c: "No PL/SQL procedure or variable 'VERSION' found" when accessing plsql.dbms_db_version.version Oct 12, 2021
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