Oracle PL/SQL - Code for Checking Database Version

Description

Code for Checking Database Version

Demo

SQL>
SQL>-- ww  w.  j  a v  a 2  s . c om
SQL> BEGIN
  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