Oracle Database - Userenv (Current Session Informations)

Card Puncher Data Processing

About

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

How to

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;

Get the Parameters

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

CURRENT_SCHEMA

See Oracle Database - CURRENT_SCHEMA

current_user

See Oracle Database - CURRENT_USER, SESSION_USER

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!





Discover More
Card Puncher Data Processing
Oracle Database - (Application) Context

An application context is a set of (name-value|variable-value) pairs that Oracle Database stores in memory during a session. Oracle provides a built-in namespace called USERENV, which describes the current...
Card Puncher Data Processing
Oracle Database - CURRENT_SCHEMA

When a session starts, CURRENT_SCHEMA has the value of the schema owned by SESSION_USER. To get the current value of CURRENT_SCHEMA, CURRENT_USER, or SESSION_USER, use the userenv context: CURRENT_SCHEMA...
Card Puncher Data Processing
Oracle Database - CURRENT_USER, SESSION_USER

When a session starts, CURRENT_USER has the same value as SESSION_USER and give the user id To get the current value of: CURRENT_SCHEMA, CURRENT_USER, or SESSION_USER use the userenv CONTEXT...
Card Puncher Data Processing
Oracle Database - Session

One session = One connection = One transaction (one user behind its screen) For session variable, see SESSIONID - The auditing session identifier. You cannot use this attribute in distributed...



Share this page:
Follow us:
Task Runner