Oracle / PLSQL: USERENV Function

This article is written about how to use the Oracle/PLSQL USERENV function with syntax and examples.


The Oracle/PLSQL USERENV characteristic can be used to retrieve records about the current Oracle session. Although this function nevertheless exists in Oracle for backwards compatibility, it is endorsed that you use the SYS_CONTEXT function instead.


The syntax for the USERENV characteristic in Oracle/PLSQL is:

USERENV( parameter )

Parameters or Arguments

parameter The cost to return from the current Oracle session. The feasible values are: Parameter Explanation CLIENT_INFO Returns consumer session statistics stored using the DBMS_APPLICATION_INFO package ENTRYID Available auditing entry identifier INSTANCE The identifier variety of the present day instance ISDBA Returns TRUE if the consumer has DBA privileges. Otherwise, it will return FALSE. LANG The ISO abbreviation for the language LANGUAGE The language, territory, and persona of the session in the following format: language_territory.characterset SESSIONID The identifier of the auditing session SID The session ID TERMINAL The OS identifier of the modern-day session


The USERENV function returns a numeric cost when the following parameters are provided: ENTRYID, SESSIONID, SID. The USERENV characteristic returns a VARCHAR2 when the following parameters are provided: CLIENT_INFO, INSTANCE, ISDBA, LANG, LANGUAGE, TERMINAL.

Applies To

The USERENV feature can be used in the following variations of Oracle/PLSQL:

Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i, Oracle 8i


Let’s seem to be at some Oracle USERENV feature examples and explore how to use the USERENV characteristic in Oracle/PLSQL.

For example:

Result: 0