The Oracle/PLSQL SYS_CONTEXT function can be used to retrieve information about the Oracle environment.
Syntax :
SYS_CONTEXT( namespace, parameter [, length] )Arguments Detail:
namespace
An Oracle namespace that has already been created. If the namespace of 'USERENV' is used, attributes describing the current Oracle session can be returned.
parameter
A valid attribute that has been set using the DBMS_SESSION.set_context procedure.
length
Optional. It is the length of the return value in bytes. If this parameter is omitted or if an invalid entry is provided, the sys_context function will default to 256 bytes.
Example Script:
SELECT SYS_CONTEXT ('userenv', 'AUTHENTICATED_IDENTITY') AUTHENTICATED_IDENTITY,SYS_CONTEXT ('userenv', 'AUTHENTICATION_METHOD') AUTHENTICATION_METHOD,SYS_CONTEXT ('userenv', 'CURRENT_SCHEMA') CURRENT_SCHEMA,
SYS_CONTEXT ('userenv', 'HOST') HOST,
SYS_CONTEXT ('userenv', 'INSTANCE_NAME') INSTANCE_NAME,
SYS_CONTEXT ('userenv', 'IP_ADDRESS') IP_ADDRESS,
SYS_CONTEXT ('userenv', 'LANG') LANG,
SYS_CONTEXT ('userenv', 'LANGUAGE') LANGUAGE,
SYS_CONTEXT ('userenv', 'MODULE') MODULE,
SYS_CONTEXT ('userenv', 'NETWORK_PROTOCOL') NETWORK_PROTOCOL,
SYS_CONTEXT ('userenv', 'NLS_CALENDAR') NLS_CALENDAR,
SYS_CONTEXT ('userenv', 'NLS_CURRENCY') NLS_CURRENCY,
SYS_CONTEXT ('userenv', 'NLS_DATE_FORMAT') NLS_DATE_FORMAT,
SYS_CONTEXT ('userenv', 'OS_USER') OS_USER,
SYS_CONTEXT ('userenv', 'SERVICE_NAME') SERVICE_NAME,
SYS_CONTEXT ('userenv', 'SESSIONID') SESSIONID,
SYS_CONTEXT ('userenv', 'SID') SID,
SYS_CONTEXT ('userenv', 'TERMINAL') TERMINAL
FROM DUAL;