Search code examples
sqlplus

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

  • Within SQL*Plus, there are some preDEFINEd substitution variable:

    SQL> define
    DEFINE _DATE           = "23-NOV-13" (CHAR)
    DEFINE _CONNECT_IDENTIFIER = "" (CHAR)
    DEFINE _USER           = "" (CHAR)
    DEFINE _PRIVILEGE      = "" (CHAR)
    DEFINE _SQLPLUS_RELEASE = "1102000100" (CHAR)
    DEFINE _EDITOR         = "Notepad" (CHAR)
    

    Notice the _SQLPLUS_RELEASE. You reference this in SQLPLUS.

    For example, you can do something like:

    sqlplus -S /nolog<<EOF
    prompt &_SQLPLUS_RELEASE
    quit
    EOF