queryCurrentDatabase()

The sqlLib.queryCurrentDatabase() system function returns the product and release number of the currently connected database. To determine the exact values different products return, see the product documentation, or run a local test.

Syntax

  sqlLib.queryCurrentDatabase(
    product CHAR(8) inOut,
    release CHAR(8) inOut)
product
Receives the database product name. The argument must be a variable of type CHAR and length 8.
release
Receives the database release level. The argument must be a variable of type CHAR and length 8.

Example

The following example checks to ensure the database is the latest version:

  dbName, dbVersion CHAR(8);
  latestVersion CHAR(8) = "V9012";
  errMsg STRING;

  function main();
    sqlLib.queryCurrentDatabase(dbName, dbVersion);
    if (dbVersion != latestVersion)
      errMsg = "Contact IT to get the latest version of " + dbName;
      writeStderr (errMsg);
    end
  end

Feedback