Search notes:

Oracle: DBMS_DB_VERSION

dbms_db_version stores the Oracle version numbers which can be used for conditional compilation.

VERSION and RELEASE

Both, version and release are constant pls_integer values:
begin

  dbms_output.put_line('Version: ' || dbms_db_version.version);
  dbms_output.put_line('Release: ' || dbms_db_version.release);

end;
/

Constants

dbms_db_version defines a few boolean constants that can be used to determine if a given Oracle version or higher is present:
ver_le_9_1 Deprecated as of 19c
ver_le_9_2 Deprecated as of 19c
ver_le_9 Deprecated as of 19c
ver_le_10_1 Deprecated as of 19c
ver_le_10_2 Deprecated as of 19c
ver_le_10 Deprecated as of 19c
ver_le_11_1 Deprecated as of 19c
ver_le_11_2
ver_le_11
ver_le_12_1
ver_le_12_2
ver_le_12
ver_le_18
ver_le_19
etc…
For example, dbms_db_version.ver_le_10 is true when running on Version 10 or earlier.

Conditional compilation

The constants in dbms_db_version are static, so they can be used in Conditional Compilation.
create or replace procedure tq84_version_test
   authid definer
as begin

   $if dbms_db_version.ver_le_18 $then
       raise_application_error(-20800, 'Upgrade to a newer Oracle version');
   $end

   dbms_output.put_line('do stuff that is only possible with Oracle 18 or so');

end tq84_version_test;
/

See also

dbms_utility.db_version
Oracle DBMS PL/SQL packages
dbms_registry_basic.sql
Determine database versions

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758198968, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/databases/Oracle/installed/packages/dbms/db_version/index(103): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78