Purpose
USERENV() queries information about the current session. This function cannot be used under the CHECK constraint.
Syntax
USERENV('parameter')
Parameters
The following describes the valid values of parameter.
| Value | Description |
|---|---|
| CLIENT_INFO | The information about the user session, which contains up to 64 bytes. Applications can store the information in the DBMS_APPLICATION_INFO system package. |
| INSTANCE | The ID of the current instance. |
| LANG | The abbreviated name of the language, which is shorter than LANGUAGE. |
| LANGUAGE | The language, region, and database character set of the current session, which is in language_territory.characterset format. |
| SCHEMAID | The schema ID. |
| SESSIONID | The ID of the audit session. |
| SID | The session ID. |
Return values
This function returns NUMBER values when the SESSIONID or SID parameter is specified, and returns VARCHAR2 values when other paramters are specified.
Examples
obclient> SELECT USERENV('LANGUAGE') "Language" FROM DUAL;
+---------------------------+
| Language |
+---------------------------+
| AMERICAN_AMERICA.AL32UTF8 |
+---------------------------+
1 row in set
obclient> SELECT USERENV('SCHEMAID') FROM DUAL;
+---------------------+
| USERENV('SCHEMAID') |
+---------------------+
| 201006 |
+---------------------+
1 row in set