USERENV

2024-03-05 01:54:27  Updated

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 the language_territory.characterset format.
SCHEMAID The schema ID.
SESSIONID The ID of the audit session.
SID The session ID.

Return type

The return type is NUMBER when the SESSIONID or SID parameter is specified. Otherwise, the return type is VARCHAR2.

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

Contact Us