Skip Headers
Oracle® OLAP Expression Syntax Reference
Release 11.2

Part Number E23381-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

SYS_CONTEXT

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.

Return Value

VARCHAR2

Syntax

SYS_CONTEXT ('namespace', 'parameter')

Arguments

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.

Table 3-3 USERENV Attributes

USERENV Attribute Description

AUTHENTICATED_IDENTITY

The identity used for authentication, such as database user name, schema name, or operating system login name.

AUTHENTICATION_METHOD

The method of authentication, such as PASSWORD, OS, or SSL.

CURRENT_EDITION_ID

The session edition identifier, such as 100.

CURRENT_EDITION_NAME

The session edition name, such as ORA$BASE.

CURRENT_SCHEMA

The name of the currently active default schema, such as SH.

CURRENT_SCHEMA_ID

The numeric identifier of the currently active default schema, such as 80.

CURRENT_USER

The name of the database user whose privileges are currently active, such as SH.

CURRENT_USERID

The numeric identifier of the database user whose privileges are currently active, such as 80.

DATABASE_ROLE

Data Guard role of the database: PRIMARY, PHYSICAL STANDBY, LOGICAL STANDBY, or SNAPSHOT STANDBY.

DB_DOMAIN

The network domain of the database as specified by the DB_DOMAIN initialization parameter, such as us.example.com.

DB_NAME

The name of the database as specified by the DB_NAME initialization parameter.

DB_UNIQUE_NAME

The unique name of the database within the domain as specified by the DB_UNIQUE_NAME initialization parameter.

ENTERPRISE_IDENTITY

The enterprise-wide identity of the user, or NULL for local users, SYSDBA, and SYSOPER.

FG_JOB_ID

Job identifier of the current session if a client foreground process opened it; otherwise, NULL.

GLOBAL_CONTEXT_MEMORY

The number used in the System Global Area by the globally accessed context.

GLOBAL_UID

The global user identification from Oracle Internet Directory for Enterprise User Security logins; otherwise, NULL.

HOST

The name of the client host computer.

IDENTIFICATION_TYPE

The way the user schema was created in the database: LOCAL, EXTERNAL, GLOBAL SHARED, or GLOBAL PRIVATE.

INSTANCE

The identification number of the current instance, such as 1.

INSTANCE_NAME

The name of the database instance.

IP_ADDRESS

The IP address of the client, such as 10.255.255.255.

ISDBA

TRUE if the user was authenticated with DBA privileges; otherwise, FALSE.

LANG

A short name for the session language, such as US for AMERICAN.

LANGUAGE

The language, territory, and database character set in the form language_territory.characterset, such as AMERICA_AMERICAN.WE8DEC.

MODULE

The application name set through the DBMS_APPLICATION_INFO package or OCI, such as JDBC Thin Client or SQL Developer.

NETWORK_PROTOCOL

The network protocol being used for communication, such as TCP.

NLS_CALENDAR

The session calendar, such as GREGORIAN.

NLS_CURRENCY

The session currency mark, such as $.

NLS_DATE_FORMAT

The session date format, such as DD-MON-RR.

NLS_DATE_LANGUAGE

The session date language, such as AMERICAN.

NLS_SORT

BINARY or a linguistic sort basis, such as XSPANISH.

NLS_TERRITORY

The session territory, such as AMERICA.

OS_USER

The operating system user name of the client process that initiated the database session.

SERVER_HOST

The host name of the computer where the database instance is running.

SERVICE_NAME

The name of the service the session is connected to., such as SYS$USERS.

SESSION_USER

The database user name or schema name that identified the user at login, such as SH.

SESSIONID

The session identifier, such as 120456.

SID

The session number, such as 86.


Example

SYS_CONTEXT('USERENV','NLS_DATE_FORMAT') returns a value such as DD-MON-RR.