'How to know sqlplus version from inside sqlplus

I am offered (by some framework) to run commands in sqlplus, but am not launching it myself. I'd like to know the version of that sqlplus running.



Solution 1:[1]

You can just use command :

sqlplus -V

And you should get :

SQL*Plus: Release 18.0.0.0.0 - Production
Version 18.3.0.0.0

Or :

SQL*Plus: Release 19.0.0.0.0 - Production
Version 19.12.0.0.0

Solution 2:[2]

I don't think you can with an actual query. You may be able to get it with this:

SELECT
  PROGRAM, MODULE
from    v$session s
order by s.sid;

The Module column may contain the version number, it might not. It depends on the program. If memory serves correctly, sqlplus does not give this. For example, TOAD gives "TOAD Freeware 11.0.0.116"

Solution 3:[3]

> select &_sqlplus_release from dual;
old   1: select &_sqlplus_release from dual
new   1: select 1803000000 from dual

1803000000
----------
1803000000

Solution 4:[4]

You can also just connect to sqlplus through commande line. In LINUX you can do the following:

[orafresh@ljsrv1123 ~]$ sqlplus / as sysdba

Which will return:

SQL*Plus: Release 11.1.0.7.0 - Production on Fri Jul 14 12:47:36 2017

Copyright (c) 1982, 2008, Oracle. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 user3136281
Solution 2 vcsjones
Solution 3 Rossco
Solution 4 TylerH