sys_context()函数用法解析
2016-12-02 16:23
507 查看
--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的值: 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
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
相关文章推荐
- sys_context()函数功能一览
- Oracle中sys_connect_by_path函数用法
- 解析PHP可变函数的经典用法
- SYS_CONNECT_BY_PATH函数用法 ORACLE
- 解析php session_set_save_handler 函数的用法(mysql)
- sys_context()的用法
- userenv和sys_context函数
- “函数的返回类型为引用”用法解析
- SYS_CONNECT_BY_PATH函数用法 ORACLE
- userenv和sys_context函数
- Oracle USERENV函数和sys_context函数
- oracle sys_context 的用法
- sprintf函数用法解析
- userenv和sys_context函数
- USERENV和SYS_CONTEXT用法
- 解析php session_set_save_handler 函数的用法(mysql)
- sys_context 的用法
- 解析PHP中ob_start()函数的用法
- php加密解密函数authcode的用法详细解析