Skip to content

Instantly share code, notes, and snippets.

@Tracnac
Created September 23, 2022 17:41
Show Gist options
  • Select an option

  • Save Tracnac/f39dcdfd2fdf26bcc2ea9f81b11b267c to your computer and use it in GitHub Desktop.

Select an option

Save Tracnac/f39dcdfd2fdf26bcc2ea9f81b11b267c to your computer and use it in GitHub Desktop.
Oracle Version with patchset #oracle
with drh as (
select max(regexp_replace(comments, '[^[:digit:].]'))
keep (dense_rank last order by action_time) as vers
from dba_registry_history
)
, v$v as (
select regexp_substr(banner, '(\d+\.?){5}', 1) as vers
from v$version
where lower(banner) like 'oracle%'
)
select coalesce(drh.vers, v$v.vers) as patch_set
from drh
right outer join v$v
on 1 = 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment