In Identifying Your Oracle Database Software Release Oracle states that you can find your "platform-specific release number" (patch set) by querying PRODUCT_COMPONENT_VERSION:
To identify the release of Oracle Database that is currently installed and to see the release levels of other database components you are using, query the data dictionary view PRODUCT_COMPONENT_VERSION.
According to this we are using 11.2.0.3.0
SQL> select * from product_component_version;
PRODUCT VERSION STATUS
----------------------------------- --------------- ---------------
NLSRTL 11.2.0.3.0 Production
Oracle Database 11g 11.2.0.3.0 64bit Production
PL/SQL 11.2.0.3.0 Production
TNS for Linux: 11.2.0.3.0 Production
The same occurs with V$VERSION (which PRODUCT_COMPONENT_VERSION is a view of incidentally):
SQL> select * from v$version;
BANNER
---------------------------------------------------------
Oracle Database 11g Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
However, according to DBA_REGISTRY_HISTORY the database appears to be on 11.2.0.3.51:
SQL> select action, namespace, version, id, comments from dba_registry_history;
ACTION NAMESPACE VERSION ID COMMENTS
--------------- --------- ---------- ---------- ------------------------------
VIEW INVALIDATE 8289601 view invalidation
UPGRADE SERVER 11.2.0.3.0 Upgraded from 11.2.0.1.0
APPLY SERVER 11.2.0.3 0 Patchset 11.2.0.2.0
APPLY SERVER 11.2.0.3 5 PSU 11.2.0.3.5
DBA_REGISTRY_HISTORY doesn't necessarily have any data in it so I can't reliably use this view. And, Oracle doesn't seem to provide a standardised method of populating the comments field I seem to be left doing the following and then praying that it works.
select max(regexp_replace(comments, '[^[:digit:].]'))
keep (dense_rank first order by action_time desc)
from dba_registry_history
Is there an easier, reliable, method of finding out the current version, including patch set, programmatically?
1. Also possible: I'm completely misreading this and people have forgotten what they patched.