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.
SQL> BEGIN-- from w w w. j a v a 2s . c o m
2 $IF DBMS_DB_VERSION.VER_LE_10_1 $THEN -- selection directive begins
3 $ERROR 'unsupported database release' $END -- error directive
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
Release 11.2 is supported.
PL/SQL procedure successfully completed.