DB2 10.5 for Linux, UNIX, and Windows

DB_VERSION procedure - Retrieve the database version

The DB_VERSION procedure returns the version number of the database.

Syntax

Read syntax diagramSkip visual syntax diagram
>>-DBMS_UTILITY.DB_VERSION--(--version--,--compatibility--)----><

Parameters

version
An output argument of type VARCHAR(1024) that returns the database version number.
compatibility
An output argument of type VARCHAR(1024) that returns the compatibility setting of the database.

Authorization

EXECUTE privilege on the DBMS_UTILITY module.

Examples

Example 1: The following anonymous block displays the database version information.
SET SERVEROUTPUT ON@

BEGIN
  DECLARE v_version VARCHAR(80);
  DECLARE v_compat VARCHAR(80);

  CALL DBMS_UTILITY.DB_VERSION(v_version, v_compat);
  CALL DBMS_OUTPUT.PUT_LINE('Version: ' || v_version);
  CALL DBMS_OUTPUT.PUT_LINE('Compatibility: ' || v_compat);
END@
This example results in the following output:
SET SERVEROUTPUT ON
DB20000I  The SET SERVEROUTPUT command completed successfully.

BEGIN
  DECLARE v_version VARCHAR(80);
  DECLARE v_compat VARCHAR(80);

  CALL DBMS_UTILITY.DB_VERSION(v_version, v_compat);
  CALL DBMS_OUTPUT.PUT_LINE('Version: ' || v_version);
  CALL DBMS_OUTPUT.PUT_LINE('Compatibility: ' || v_compat);
END
DB20000I  The SQL command completed successfully.

Version: DB2 v9.7.0.0
Compatibility: DB2 v9.7.0.0