Introduction

The DBMS_DB_VERSION package provides these static constants:

  • PLS_INTEGER type constant VERSION identifies the current Oracle Database version.
  • PLS_INTEGER type constant RELEASE identifies the current Oracle Database release number.
  • Each BOOLEAN constant of the form VER_LE_v has the value TRUE if the database version is less than or equal to v; otherwise, it has the value FALSE.
  • Each BOOLEAN constant of the form VER_LE_v_r has the value TRUE if the database version is less than or equal to v and release is less than or equal to r; otherwise, it has the value FALSE.

Demo

SQL>
SQL> BEGIN--   ww  w .ja v  a 2  s. c  o  m
  2   $IF DBMS_DB_VERSION.VER_LE_10_1 $THEN         -- selection directive begins
  3     $ERROR 'unsupported database release' $END  -- error directive
  4   $ELSE
  5     DBMS_OUTPUT.PUT_LINE ('Release ' || DBMS_DB_VERSION.VERSION || '.' ||DBMS_DB_VERSION.RELEASE || ' is supported.');
  6   COMMIT WRITE IMMEDIATE NOWAIT;
  7   $END                                          -- selection directive ends
  8  END;
  9  /
Release 11.2 is supported.

PL/SQL procedure successfully completed.

SQL>
SQL>

Related Topic