Oracle SQL / PLSQL USERENV function is used to get the information about the current Oracle Session.
Oracle SQL / PLSQL syntax for the USERENV function is:
SELECT USERENV (parameter)
FROM table_name;
The parameter is the value that is passed to the USERENV function.
The possible values of parameter are shown below:
Parameter | Explanation |
CLIENT_INFO | Returns user session information stored using the DBMS_APPLICATION_INFO package |
ENTRYID | Available auditing entry identifier |
INSTANCE | The number of the current instance |
ISDBA | Returns TRUE if the user has DBA privileges. Else, returns FALSE. |
LANG | The ISO abbreviation for the language e.g. US |
LANGUAGE | The language, territory, and character of the session. In the following format: language_territory.characterset. |
SESSIONID | The identifier of the auditing session e,g, 24000 |
TERMINAL | The OS identifier of the current session |
Example 1 of using the Oracle SQL USERENV function
SELECT USERENV('SESSIONID') FROM dual;
May return ‘24000’ or ‘23456’ or any other number
Example 2 of using the Oracle SQL USERENV function
SELECT USERENV('LANGUAGE') FROM dual;
May return ‘AMERICAN_AMERICA.WE8MSWIN1252’