--sys_context
SYS_CONTEXT('namespace', 'parameter' [, length ])
SYS_CONTEXT returns the value of parameter associated with the context namespace at the current instant. You can use this function in both SQL and PL/SQL statements. SYS_CONTEXT must be executed locally.
The namespace must be a valid SQL identifier. The parameter name can be any string. It is not case sensitive, but it cannot exceed 30 bytes in length.
Oracle provides the following built-in namespaces:
USERENV - Describes the current session. The predefined parameters of namespace USERENV are listed in Table 5-11.
SYS_SESSION_ROLES - Indicates whether a specified role is currently enabled for the session. This namespace is available starting with Oracle Database 11g Release 2 (11.2.0.4).
parameter的值:
SYS_CONTEXT('namespace', 'parameter' [, length ])
SYS_CONTEXT returns the value of parameter associated with the context namespace at the current instant. You can use this function in both SQL and PL/SQL statements. SYS_CONTEXT must be executed locally.
The namespace must be a valid SQL identifier. The parameter name can be any string. It is not case sensitive, but it cannot exceed 30 bytes in length.
Oracle provides the following built-in namespaces:
USERENV - Describes the current session. The predefined parameters of namespace USERENV are listed in Table 5-11.
SYS_SESSION_ROLES - Indicates whether a specified role is currently enabled for the session. This namespace is available starting with Oracle Database 11g Release 2 (11.2.0.4).
parameter的值:
http://docs.oracle.com/cd/E11882_01/server.112/e41084/functions184.htm#SQLRF06117
EODA@PROD1> select SYS_CONTEXT('USERENV','LANGUAGE') language from dual;
LANGUAGE
----------------------------------------------------------------------------------------------------
AMERICAN_AMERICA.AL32UTF8
EODA@PROD1> select SYS_CONTEXT('USERENV','CURRENT_USER') current_user from dual;
CURRENT_USER
----------------------------------------------------------------------------------------------------
EODA
EODA@PROD1> select sys_context('userenv', 'sid') from dual;
SYS_CONTEXT('USERENV','SID')
----------------------------------------------------------------------------------------------------
50