| Oracle® OLAP Expression Syntax Reference Release 11.2 E23381-01 | 
 | 
| 
 | PDF · Mobi · ePub | 
SYS_CONTEXT returns the value of an attribute of a named context. The context, attribute, and value must already be defined in the database. If the context is not defined, SYS_CONTEXT returns NULL.
VARCHAR2
SYS_CONTEXT ('namespace', 'parameter')
namespace can be any named context in the database. USERENV is a built-in context that describes the current session.
parameter is a defined attribute of namespace. Table 3-3 describes the predefined attributes of USERENV that are most likely to have values. For a complete list, refer to the SYS_CONTEXT entry in the Oracle Database SQL Language Reference.
| USERENV Attribute | Description | 
|---|---|
| 
 | The identity used for authentication, such as database user name, schema name, or operating system login name. | 
| 
 | The method of authentication, such as  | 
| 
 | The session edition identifier, such as  | 
| 
 | The session edition name, such as  | 
| 
 | The name of the currently active default schema, such as  | 
| 
 | The numeric identifier of the currently active default schema, such as  | 
| 
 | The name of the database user whose privileges are currently active, such as  | 
| 
 | The numeric identifier of the database user whose privileges are currently active, such as  | 
| 
 | Data Guard role of the database:  | 
| 
 | The network domain of the database as specified by the  | 
| 
 | The name of the database as specified by the  | 
| 
 | The unique name of the database within the domain as specified by the  | 
| 
 | The enterprise-wide identity of the user, or  | 
| 
 | Job identifier of the current session if a client foreground process opened it; otherwise,  | 
| 
 | The number used in the System Global Area by the globally accessed context. | 
| 
 | The global user identification from Oracle Internet Directory for Enterprise User Security logins; otherwise,  | 
| 
 | The name of the client host computer. | 
| 
 | The way the user schema was created in the database:  | 
| 
 | The identification number of the current instance, such as  | 
| 
 | The name of the database instance. | 
| 
 | The IP address of the client, such as  | 
| 
 | 
 | 
| 
 | A short name for the session language, such as  | 
| 
 | The language, territory, and database character set in the form  | 
| 
 | The application name set through the  | 
| 
 | The network protocol being used for communication, such as  | 
| 
 | The session calendar, such as  | 
| 
 | The session currency mark, such as $. | 
| 
 | The session date format, such as  | 
| 
 | The session date language, such as  | 
| 
 | 
 | 
| 
 | The session territory, such as  | 
| 
 | The operating system user name of the client process that initiated the database session. | 
| 
 | The host name of the computer where the database instance is running. | 
| 
 | The name of the service the session is connected to., such as  | 
| 
 | The database user name or schema name that identified the user at login, such as  | 
| 
 | The session identifier, such as  | 
| 
 | The session number, such as  | 
SYS_CONTEXT('USERENV','NLS_DATE_FORMAT') returns a value such as DD-MON-RR.