Oracle Database - Userenv (Current Session Informations)

> Database > Oracle Database

1 - About

Userenv is a pre-build context that describes the current session.

Advertising

3 - How to

3.1 - Query it

You can query the context Userenv with two functions.

SELECT SYS_CONTEXT('USERENV','SESSIONID') FROM DUAL;
  • or the USERENV function Deprectaed
SELECT USERENV('SESSIONID') FROM DUAL;

3.2 - Get the Parameters

You can see all the SYS_CONTEXT parameters in the SQL documentation. Predefined Parameters of Namespace USERENV

3.2.1 - CURRENT_SCHEMA

3.2.2 - current_user

3.2.3 - LANGUAGE

USERENV('LANGUAGE')
----------------------------------------------------
AMERICAN_AMERICA.WE8ISO8859P1

It gives the session's <language>_<territory> but the DATABASE character set, so the value returned is not the client's NLS_LANG setting!

Advertising
db/oracle/userenv.txt · Last modified: 2017/09/06 19:29 by gerardnico