Friday, January 11, 2013

UserEnv Function


In Oracle/PLSQL, the userenv function can be used to retrieve information about the current Oracle session. Although this function still exists in Oracle for backwards compatibility, it is recommended that you use the sys_context function instead.

Syntax

The syntax for the userenv function is:
userenv( parameter )
parameter is the value to return from the current Oracle session. The possible values are:
ParameterExplanation
CLIENT_INFOReturns user session information stored using the DBMS_APPLICATION_INFO package
ENTRYIDAvailable auditing entry identifier
INSTANCEThe identifier number of the current instance
ISDBAReturns TRUE if the user has DBA privileges. Otherwise, it will return FALSE.
LANGThe ISO abbreviation for the language
LANGUAGEThe language, territory, and character of the session. In the following format:
language_territory.characterset
SESSIONIDThe identifier of the auditing session
TERMINALThe OS identifier of the current session

Applies To

  • Oracle 11g, Oracle 10g, Oracle 9i, Oracle 8i

For Example

userenv('ENTRYID')would return FALSE
userenv('LANGUAGE')would return 'AMERICAN_AMERICA.WE8DEC'