Skip to content

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

Description

@joschug

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions